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?
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
-
1I'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– MLowry2013年06月14日 16:39:51 +00:00Commented Jun 14, 2013 at 16:39
-
2This Link will help you to create service which returns Json arcgis.com/home/item.html?id=6d28a606369c43fd9a6f929541ae7c93Gunner– Gunner2013年06月17日 07:17:52 +00:00Commented Jun 17, 2013 at 7:17
-
@Gunner that's a nice sampleawesomo– awesomo2013年06月17日 17:37:09 +00:00Commented Jun 17, 2013 at 17:37
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.
-
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.htmawesomo– awesomo2013年06月14日 16:54:06 +00:00Commented Jun 14, 2013 at 16:54
Explore related questions
See similar questions with these tags.
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.