Say I have a table showing a number of statistics - for example, various gun crime by US State measures. I also have a dataset of state boundaries.

How can I join the table to the features in a web map, and symbolize the polygons using attributes from the table? The joined table must be specified within the web application (rather than hard-coded via ArcMap) since the statistics will be derived on-the-fly and will be specific to each user.

I need the ability to change the symbology on-the-fly, for example by choosing a different crime statistic to map, in which case the map should update immediately.

ArcGIS Server

Using ArcGIS Server 10.1 the REST API supports table joins. Are there any sample scripts which step through how to set this up?

Other environments?

Can the same thing be achieved using FOSS software?

Thanks. (This is a modified version of my earlier question since that hasn't yet received any responses)

1 Answer 1


It looks like the API supports a "Query table data source" with query element. So you should be able use a SQL statement to handle the join and summarize the data with a group by clause. Something along the lines of this:

select st.*, gc."Handguns murders" as hg_murders
from states as st
    inner join gun_crimes as gc on gc.State=st.STATE_NAME

As for FOSS, OGR has a stripped down SQL syntax that can perform table joins. You could set this up in virtual format pulling data from a variety of underlying data sources.

  • thanks @tharen. Do you know of any samples showing how to do this? I'm experienced with the AGS JavaScript API but have no experience whatsoever with using the REST API directly, so I don't really know where to start. Jan 29, 2012 at 7:39
  • Drilling down into the docs there is an example setting up a datasource using both the SQL method and also setting up a join datasource. Other than that I'm not sure where to point you. A SQL join should work if you have the tables in a database. Note I modified the example assuming the geometry was in the states table.
    – tharen
    Jan 29, 2012 at 8:56
  • @StephenLead, have you got any solution for this. As I am also searching for the same. Can you guide me?
    – Kishor
    Feb 14, 2019 at 6:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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