Select to view content in your preferred language

Incorporating Data from Ancillary Sources

924
6
10-10-2010 01:45 PM
AaronEdwards
Emerging Contributor
Hi,

I'm new to GIS and mapping applications, so this may be a dumb question.

I'm trying to incorporate tabular data from a local SQL Server database with spatial data that I'm getting from a map service, particularly (for now), in the Map Tip. 

I've already managed, with this forum's help (thank you, Dominique) to use a simple Converter to take one piece of data from the map service (a site's primary key), and use it to lookup and return a different piece of data (the site's name) that's not returned by the service.  However, that's a really simple case, and required me, in the Silverlight page's Loaded event handler, to fetch a dictionary of site ID's and site names and store it locally in the browser in anticipation of it being needed.

I've got boat loads more tabular data I'd like to display in the map tip.  So what I'm wondering is, what's the best approach.  As I see it, and again I'm new to GIS, there are two options:

1.  Create a local service (REST?  WCF?) that acts as a proxy to the map service.  Point the map feature layer at the local service.  That service then communicates with the actual map service, and then returns the results from the map service, plus whatever tabular data is needed from the SQL database, back to the feature layer.

2.  Handle some event of the map tip, right before it displays, to fire off a service call to a local service which fetches the tabular data I'm interested in (I don't even know if this event exists, however).

There may be other options as well.  I should mention that I don't have access to the map service, so I can't go in and tell it what additional data I'd like to return.

Anyway, if you have any suggestions, I'd me most grateful. 

Thanks.

Aaron
0 Kudos
6 Replies
dotMorten_esri
Esri Notable Contributor
Sounds like what you need is MapIt: www.esri.com/mapit
0 Kudos
AaronEdwards
Emerging Contributor
A little rich for my blood.

Any other suggestions?
0 Kudos
BrentStevener
Deactivated User
I think there should be a way to create REST endpoints to SQL Server spatial data without using MapIT, but I have yet to find a working solution. I was looking at this link that shows how to do it using ADO.NET data services and the entity model framework, but the problem I ran into is that the current entity model framework doesn't support the spatial data types that are in Sql Server 2008.

Perhaps someone else out there can examine it and figure out a way and provide a simple tutorial 🙂
0 Kudos
DanielWalton
Frequent Contributor
Instead of EF you could use Linq2SQL, which is more flexible. Here is a post at StackOverflow on how to use (hack) L2S for SQL Spatial data:

http://stackoverflow.com/questions/1314523/spatial-data-types-support-in-linq2sql-or-ef4/1797509#179...

And here's a more helpful walkthrough:

http://blogs.u2u.be/diederik/post/2010/01/03/The-Missing-Linq-to-SQL-Spatial.aspx
0 Kudos
BrentStevener
Deactivated User
I think there should be a way to create REST endpoints to SQL Server spatial data without using MapIT, but I have yet to find a working solution. I was looking at this link that shows how to do it using ADO.NET data services and the entity model framework, but the problem I ran into is that the current entity model framework doesn't support the spatial data types that are in Sql Server 2008.

I found this link that goes over a way to do a 'hack' by creating a view that casts the spatial column to binary, which then gets converted back to the sql geometry on the client side.

You would then need to convert the entities into the ESRI objects that are supported in whatever API that you are using.

Instead of this, I just used a published map service that contained a query layer. The query layer is able to access the SQL Server spatial data and display it inside of the service. However, doing it by REST would eliminate the need for a published map service, which would remove some of links in the process chain.
0 Kudos
dotMorten_esri
Esri Notable Contributor
This blogpost might also help you get started on building a service: http://blogs.esri.com/Dev/blogs/silverlightwpf/archive/2010/03/11/Sending-geometry-between-Silverlig...

All you really need is to add a SQL query to that sample...
0 Kudos