Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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)

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

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.

share|improve this answer
    
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. –  Stephen Lead Jan 29 '12 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 '12 at 8:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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