how add query layer in .Net WPF

3707
4
Jump to solution
10-22-2014 06:10 AM
Labels (1)
AndreiEgorov
New Contributor

I want add information from SQL Server DB to Map (object MapView in .Net WPF) how I can do it?

0 Kudos
1 Solution

Accepted Solutions
AnttiKajanus1
Occasional Contributor III

Hey,

Best way differs depending what kind of information you are using and how you want it to work but currently we don't support out-of-the-box integration with SQL Server but this doesn't mean that you cannot work with that. Can you describe your workflow and needs in more details?

I think that the easiest way to do it is to write data access against SQL server, transform those to Graphics and add to the map like that. Column information can be added as a attributes to graphics. See more from Add graphics and text—ArcGIS Runtime SDK for .NET | ArcGIS for Developers

View solution in original post

0 Kudos
4 Replies
AnttiKajanus1
Occasional Contributor III

Hey,

Best way differs depending what kind of information you are using and how you want it to work but currently we don't support out-of-the-box integration with SQL Server but this doesn't mean that you cannot work with that. Can you describe your workflow and needs in more details?

I think that the easiest way to do it is to write data access against SQL server, transform those to Graphics and add to the map like that. Column information can be added as a attributes to graphics. See more from Add graphics and text—ArcGIS Runtime SDK for .NET | ArcGIS for Developers

0 Kudos
AndreiEgorov
New Contributor

Thank you for answer!

I did so:

1) Read SQL Data (geography type) use query ""SELECT SpatialLocation.Lat,SpatialLocation.Long FROM [AdventureWorks2012].[Person].[Address]"

2)Read With ADO NET

3)Create "SimpleMarkerSymbol" using the converted Latitude and Longitude.

      static public void ToWebMercator(ref double mercatorX_lon, ref double mercatorY_lat)

        {

            if ((Math.Abs(mercatorX_lon) > 180 || Math.Abs(mercatorY_lat) > 90))

                return;

            double num = mercatorX_lon * 0.017453292519943295;

            double x = 6378137.0 * num;

            double a = mercatorY_lat * 0.017453292519943295;

            mercatorX_lon = x;

            mercatorY_lat = 3189068.5 * Math.Log((1.0 + Math.Sin(a)) / (1.0 - Math.Sin(a)));

        }

I would be glad if you write more than a simple way to do it!

0 Kudos
AnttiKajanus1
Occasional Contributor III

Good suggestion, I might write sample that that shows the principle how to add graphics from POCO that is read using  custom data sources (sql sever, txt file, or what ever).

0 Kudos
AnttiKajanus1
Occasional Contributor III

Created short blog post and sample Showing data from custom data source on map with ArcGIS Runtime for .NET

All comments are very welcome.

0 Kudos