Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have heard of people using the ESRI Javascript API to create webmaps with spatial data from SQL Server or other RDBMS's. From what I can tell, they are not using ArcGIS Server as a middleware. In particular, I recently heard of a company that uses a SQL Server database with spatial types and Entity Framework to link the database to the app, but then they are using the ESRI JS API on the front end to render the data.

This is something that really interests me as I have worked with SQL Server, Entity Framework, ASP.Net, and the JS API separately and I do not have access to ArcGIS Server. Does anyone know of a particular architecture or workflow for simply using the JS API as a front end for a non ESRI backend?

share|improve this question
1  
The short answer is to send data as JSON from a service. But to see if that is possible, you'll need to answer questions like: What kind of data do you want to show on the map? How many features? how many layers? –  Devdatta Tengshe Jun 14 '13 at 15:09
1  
Another option is to use Geoserver to serve out data stored in MS SQL Server: docs.geoserver.org/2.1.3/user/data/sqlserver.html –  Devdatta Tengshe Jun 14 '13 at 15:10
    
@DevdattaTengshe - If I were to create a JSON service, would I need my JSON structure to mimic the structure used by the JS API. For instance, would I need to serve up my tables as FeatureLayer objects? RIght now I am working on a project using ArcGIS Online and JS API. The problem is that I can't do any processing in AGOL so any calculations must be done client side. I'm working with only a few layers, but some of them could have hundreds of thousands of features. –  Brian Jun 14 '13 at 15:32
    
@DevdattaTengshe - I've heard of Geoserver and would really like to try it some day. I'm still not sure how I would use Geoserver with a server-side web application using something like ASP.Net and Entity Framework. I fear that I would run into the same limits with Geoserver that I am seeing with AGOL. –  Brian Jun 14 '13 at 15:33
    
Yes you'll have to mimic the ERSI JSON format for easy interoperability. –  Devdatta Tengshe Jun 14 '13 at 15:34
show 2 more comments

2 Answers

Just to add more detail, when you create a service to return JSON from SQL Server, you would then use the feature collection object to create a new layer on the map. From javascript, you would take the attributes and the spatial component returned from your service and format it to the Esri geometry format to create the feature collection.

The closer your server returns a format like the Esri format, the less parsing you have to do on the client. JSON is pretty easy to parse once you get the hang of it.

The feature collection displayed would be a graphic layer on the map. You could have an Esri or other public base map underneath. One issue you will have is performance when you start approaching thousands of features -- particularly if they have a lot of vertices per geometry. Feature services on ArcGIS server return a max 1000 records by default.

As far as calculations, you should do them with SQL (it has spatial extensions) in the database before returning them to the client. If you are trying to display hundreds of thousands of features though, you are going to have to use Geoserver or UMN Mapserver and return them as WMS or a tiled service -- you can't display that many graphics in the browser.

Check out this sample where a layer is created from a Flickr data feed. No ArcGIS Server involved -- http://developers.arcgis.com/en/javascript/jssamples/fl_featureCollection.html

share|improve this answer
    
I'm interested in how to create a service which returns JSON from SQL Server which is formatted well for the Esri JS API to parse out. –  MLowry Jun 14 '13 at 16:39
1  
This Link will help you to create service which returns Json arcgis.com/home/item.html?id=6d28a606369c43fd9a6f929541ae7c93 –  Gunner Jun 17 '13 at 7:17
    
@Gunner that's a nice sample –  awesomo Jun 17 '13 at 17:37
add comment

enter image description here

How to use SQL Spatial Data with WCF ODATA Spatial might be one way. Since OData was developed after Esri's REST spec, and with more involvement with Microsoft, it might be a bit more mature.

share|improve this answer
    
That's a good link. Here's a decent one for just creating a simple JSON service out of SQL Server mikesknowledgebase.com/pages/Services/WebServices-Page2.htm –  awesomo Jun 14 '13 at 16:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.