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....
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?
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
Dim myLayer As SharpMap.Layers.VectorLayer = New SharpMap.Layers.VectorLayer("My layer")
myLayer.DataSource = New SharpMap.Data.Providers.ShapeFile("states.shp")
myLayer.MaxVisible = 40000
'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
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.
Oct 18, 2006 at 10:30 PM
You need to project your Lat Long coords into the map coordinates. Which projection is your underlying layers using?