This project is read-only.

Map Lat/Lon Grid

Oct 15, 2010 at 4:36 PM

Do you guys have any intention of putting a Lat/Lon grid on the map in DotSpatial or MapWindow 6?  It would be nice to have something like that can be turned on and off easily.

Oct 15, 2010 at 5:54 PM

Have you considered writing a quick script using the DotSpatial.Data.FeatureSet to create a line shapefile?  Simply dimension a new FeatureSet(FeatureType.Line), then cycle through all the lines of latitude at whatever frequency you like, and create a new line feature that stretches from -180 to 180 longitude.  Then do the same, stretching longitudinal lines from -90 to 90.  Use the SaveAs(filename) method to save it.  Then, later you can show that in your map like a layer.

The only snag I can see with supporting it at the map level is that sometimes the projection is not specified, and so in those cases it may not be obvious where the lines of latitude are supposed to be.  We could always have it work based on the map projection, and default to WGS84 if no other projected data is loaded yet.  Also, reprojecting the entire lat-lon grid when you are looking at a small dataset in say a state-plane coordinate system is not possible.  It tends to produce some invalid values.  So before we realistically support this, we would have to come up with slightly more elegant projection on the fly features like cropping a dataset to only show the valid projected region for projected coordinate system.  In the meantime it's not that hard for you to create a layer that shows the lines.



Oct 15, 2010 at 5:55 PM

BTW if you are doing this programmatically and don't want the line of latitude/longitude to appear in the legend, just add the new layer to the Map.MapFrame.DrawingLayers instead of the Map.Layers.