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

1176
2
11-18-2011 06:31 AM
BrandonCopeland
New Contributor
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.

0 Kudos
2 Replies
derekswingley1
Frequent Contributor
I think this is well beyond the scope of this forum but I would say go with the option that makes the client's/user's life easier. It may be more work on your end, but the easier you make like for your clients, the happier they will be, IMO.

I would think about it this way: do more work now, make life easier for your client which means fewer questions/support requests in the future or you make the client do more work which results in more effort required to support them/make them successful in using your stuff.
0 Kudos
BrandonCopeland
New Contributor
Thanks Derek. I agree.

In hindsight, I guess my question was more of "What are the typical ways of accessing third party HTTP APIs and providing that data through RESTful applications/APIs?". Not really related to ESRI's API at all. 🙂
0 Kudos