I have a shapefile with areas (eg. a simple world map with countries - polygons, epsg:4326). I also have a point (lat, lon coordinates).

What's the simplest/easiest way to figure out in which polygon (country) that point is? Polygons are not overlapping.

I have to do this server-side for many points, so i'm thinking about using mapnik, or any other library for that. (Linux server, opensource/free software only).


I think you are looking for a "Spatial Join": assigning attributes of the polygon to any point that is overlapping it. (Ex: Chicago city point overlaps Illinois polygon, therefore Illinois attribute is assigned to Chicago point)

ArcGIS has a simple tool to for this. For open-source I would consider this QGIS tutorial: http://www.qgistutorials.com/en/docs/performing_spatial_joins.html

I have used the open-source Geospatial Modeling Environment (GME) to do "Count Points in Polygon" - I can't remember if that tool can also assign the polygon attribute to the point: http://www.spatialecology.com/gme/countpntsinpolys.htm

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.