I'm doing a project using ArcGIS JavaScript API v3.5 hosted on ArcServer v10.1. While reading the question below, remember that I do not have control over the datasource and cannot just create a materialized view in the database to solve the issue.


The issue I'm having is that parts of the database I'm querying are very very normalized -- one table has 11 Foreign Keys that point to parent tables that are even more normalized.

You can imagine that to join all the information for a single record for all these relationships is cumbersome. It requires many requests and lots of looping and checking which is slow and error prone.

Questions: I have 2 questions:

  1. What other options are there in the JS API to make querying easier from the client? I see layer types like QueryDataSource in the API reference that seem to be what i want. But there are no examples of how that works and no one online seems to be using that solution. Has anyone here used QueryDataSource?

  2. I'm open to options on how to request that the datasources be modified. The most simple solution is to make them create a flattened table joined with all the data. What other options are there? Since I don't know the ArcGIS Server aspect as well I'm a little blind in what to request. For example, is there a way in ArcMap to create materialized-like views for a normalized datasource? Another possible solution is that the API should gather all related records up for me and spew out one big JSON object when i request a child table with many Foreign Keys. This is how I create API's in Django. All related records become nested hashes of a record. Is there someway to construct your API like this with ArcServer?

I can't wait to hear what thoughts/solutions others have for this problem

  • @stickBit: I've never used QueryDataSource so i cannot give advice there. I think the only reasonable solution is to make them flatten some of those tables out or tell them their API stinks and will slow down the application. Hope that helps – maztaz Sep 8 '13 at 22:52
  • 1
    While you may be able to do this with a normal view or using joins/relates in your map document, for performance and ArcGIS compatibility reasons I would recommend what you already mentioned: Get the data provider to create a flattened table joined with all the data using SQL. Then add column & spatial indexes as necessary, register the table with ArcSDE and/or the geodatabase, and add to your map service as a normal layer. It's going to be much faster to draw than performing all of those JOINs on the fly. – greenlaw Sep 9 '13 at 13:52

Your Answer

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

Browse other questions tagged or ask your own question.