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?

  • 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? Jun 14, 2013 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 Jun 14, 2013 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, 2013 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, 2013 at 15:33
  • Yes you'll have to mimic the ERSI JSON format for easy interoperability. Jun 14, 2013 at 15:34

2 Answers 2


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


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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