copeland

Querying ArcGIS Server with .NET MVC and ArcGIS API for JavaScript

Discussion created by copeland on Nov 18, 2011
Latest reply on Nov 18, 2011 by copeland
I have gone back and forth on how to provide spatial data from ArcGIS Server in an MVC application and would like some suggestions on how to best architect this solution.

Assume a hypothetical Pipelines controller with typical CRUD style actions (Index, Details, Create, Edit). The Model for Pipelines is split between Entity Framework and ArcGIS Server. A request to the Details action would require querying EF and querying ArcGIS Server. The response could be either HTML or JSON depending on HTTP Header Accept. The question is... what's the best solution for where that ArcGIS Server query should occur and what should be provided in the controller's response?

A couple options I've considered


  • Provide all details (both spatial and non-spatial) for the Pipeline. Now my HTTP API is decoupled from ESRI, and I can construct my own Pipeline object where the underlying model(s) is abstracted for the consumer (I like). But there's a lot of work here. I have to myself make a web request from the controller and deserialize ArcGIS Server's JSON. That deserializing that can get a little tricky with more complex geometry types.

  • Provide all EF model data (non-spatial) along with data describing the ArcGIS Server query (url, where clause, out fields, etc...). This is easy, but the consumer/client is aware of the AGS model, has to themselves make that query, and has to include logic on how to combine the GIS results to the previous returned data.

Outcomes