This project has moved and is read-only. For the latest updates, please go here.

XY Data

Topics: SharpMap v0.9 / v1.x
Jan 28, 2016 at 4:51 PM
Edited Jan 28, 2016 at 4:52 PM
Hi Everyone,

I guess my question will be very basic for many of you, but I just can't display XY data on map. I have a map displaying OSM tiles. I'm trying to add a point data layer. What is the most efficient way ? My data is in a dataset ( retreived from a sql stored proc ).

I tried

Dim dsProvider = New SharpMap.Data.Providers.DataTablePoint(myDataSet.Tables(0), "OBJECTID", "[X]", "[Y]")
Dim layFires As SharpMap.Layers.VectorLayer = New SharpMap.Layers.VectorLayer("Fires", dsProvider)
layFires.SRID = 4326
Dim ctFac = New ProjNet.CoordinateSystems.Transformations.CoordinateTransformationFactory()
Dim csSrc = ProjNet.CoordinateSystems.GeographicCoordinateSystem.WGS84
Dim csTgt = ProjNet.CoordinateSystems.ProjectedCoordinateSystem.WebMercator
layFires.CoordinateTransformation = ctFac.CreateFromCoordinateSystems(csSrc, csTgt)

but my map is empty. I also tried some samples found in the forum, but still empty. Hopefully someone will be able to help me...

Thanks !
Jan 28, 2016 at 5:46 PM
Edited Jan 28, 2016 at 6:16 PM
And just to let you know... the cities.xls sample works great.... :-O

I made another test : if I put my stored proc results in the excel file. My data will be displayed on my map. But as soon as I try to display my SQL data first, the excel data won't show up anymore...
Jan 28, 2016 at 6:52 PM
Ok. I found it.... you have to convert the X and Y data to float on sql server side... :-)