1

I'm a non-coder using Cartodb. I've uploaded a dataset that has longitudinal and latitudinal coordinates, and overlayed that with a map with neighborhood boundaries. Is there a way to easily compare (or sort) these two layers? I want to be able to quickly find out which locations reside inside a certain area, without having to look at the visualization and figure it out manually. Thoughts?

1

You can use SQL to combine your two datasets like you are requesting. CartoDB has a tutorial on how to do this.

The basics of it are that you find whether a point is in a polygon... if so, you can select attributes from either data set to create a new table from. Once you have a new table, you can configure the visualization style (choropleth, category, etc.), infowindows, and more based on the new attributes in the combined table.

You can see this in the following query:

SELECT 
  table_1.the_geom, 
  table_1.iso_code, 
  count(*) as count
FROM 
  table_1
JOIN 
  table_2
 ON 
   ST_Intersects(table_1.the_geom, table_2.the_geom)
GROUP BY 
   table_1.the_geom, 
   table_1.iso_code

In your case, it seems that you want the polygons instead of the points, but want information from your points to be listed in the select statement.

  • thanks Andy. I'll play around with that and see if I can find that tutorial you mention. I'm not really interested in the visualization, just being able to sort the points by their region. – Will Wallace Sep 16 '15 at 23:46

Your Answer

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

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