Need help getting up to speed

Topics: General Topics
Oct 15, 2006 at 2:39 AM
This looks like a fantastic project and I'm hoping I can use it to bring my program up to the next level.

The program I'm working on plots air traffic. Currently I handle all the drawing of maps, plotting aircraft, panning, zooming, etc., using GDI+. But I have had some issues with zooming and panning/dragging the map because I have not found a good way to go from image to world coords. I go from world L/L to Image XY just fine. And I also need to add weather RADAR images and am having a hard time implementing that on my own.

So that's what brings me here.

The program is fairly simple. I need to have a US map and then add my own maps, and then aircraft on top of that. My maps are in this L/L format....

=
-85.67634,32.56689
-83.1818,32.56707
=
-83.1818,32.56707
-83.15313,34.67945
=
-83.15313,34.67945
-85.70986,34.67737
=
-85.70986,34.67737
-85.67634,32.56689

----Truncated----

What do I need to do to plot my maps as a layer? Just add my maps as a collection of linestrings as in this post?
http://www.codeplex.com/Wiki/View.aspx?ProjectName=SharpMap&title=Add%20a%20primitive%20geometry

But my ccords are in L/L not XY. How do I go about this?

Also, I'm trying to get to step one. Creating a demo winforms app with a US map. The problem is that when I change the zoom level to make the map fill the size of the map image, the us map starts moving off the left side of the image.

I am using code I found in the How To and from the ASP.NET example site. Can some one tell me what is wrong with this code?

I have a SharpMaps.Forms.Mapimage on the form named MapImage1. Like I said, If I change the zoom to make the US map bigger it moves off the left side of the form.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim myMap As SharpMap.Map = New SharpMap.Map(New Size(800, 600))

myMap.BackColor = Color.White
'Set background

Dim myLayer As SharpMap.Layers.VectorLayer = New SharpMap.Layers.VectorLayer("My layer")

myLayer.DataSource = New SharpMap.Data.Providers.ShapeFile("states.shp")
myLayer.MaxVisible = 40000
myMap.Layers.Add(myLayer)

'limit the zoom to 360 degrees width
myMap.MaximumZoom = 360
myMap.BackColor = Color.LightBlue

myMap.Zoom = 200
myMap.Center = New SharpMap.Geometries.Point(0, 0)

Dim imgMap As System.Drawing.Image = myMap.GetMap
MapImage1.Image = imgMap

End Sub

That's all for now, I'm sure I'll have many more questions as I get going.

Thanks for any help you can provide.

Dugr

Coordinator
Oct 18, 2006 at 11:30 PM
You need to project your Lat Long coords into the map coordinates. Which projection is your underlying layers using?