Discussion:
[Community] Question about using shapely to do "point in polygon"
Abhishek
2013-11-20 22:54:58 UTC
Permalink
Hello,

First, I'm very new to doing gis programming in python (and GIS in
general) so apologies if this has been answered before.

I was wondering if there was a straightforward way for me to do the following:
1. Read in a shapefile (all counties in the UK)
2. Read in a csv with a list of lat / lon (this I know how to do)
3. Spit out a csv with the same list of points and the polygon id from
the shapefile, indicating that the point lies within the polygon (i.e.
in the county)

Ive got this to work by manually constructing polygons from a csv
export of the shapefile, but I'm afraid that Im not going to deal very
well with holes in counties, or edge cases. A standard out-of-the-box
solution would be great.

Thanks!

Abhishek
------------
http://abhishek.mit.edu
steven citron-pousty
2013-11-20 23:00:33 UTC
Permalink
The second half of this blog post has a code example that will help you
code the test for the points being in the polygons
Post by Abhishek
Hello,
First, I'm very new to doing gis programming in python (and GIS in
general) so apologies if this has been answered before.
1. Read in a shapefile (all counties in the UK)
2. Read in a csv with a list of lat / lon (this I know how to do)
3. Spit out a csv with the same list of points and the polygon id from
the shapefile, indicating that the point lies within the polygon (i.e.
in the county)
Ive got this to work by manually constructing polygons from a csv
export of the shapefile, but I'm afraid that Im not going to deal very
well with holes in counties, or edge cases. A standard out-of-the-box
solution would be great.
Thanks!
Abhishek
------------
http://abhishek.mit.edu
_______________________________________________
Community mailing list
Community at lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20131120/1590d374/attachment.htm>
steven citron-pousty
2013-11-20 23:00:47 UTC
Permalink
helps if I paste the link
https://www.openshift.com/blogs/using-open-source-gis-tools-for-spatial-data-qgis-gdal-python


On Wed, Nov 20, 2013 at 3:00 PM, steven citron-pousty <
Post by steven citron-pousty
The second half of this blog post has a code example that will help you
code the test for the points being in the polygons
Post by Abhishek
Hello,
First, I'm very new to doing gis programming in python (and GIS in
general) so apologies if this has been answered before.
1. Read in a shapefile (all counties in the UK)
2. Read in a csv with a list of lat / lon (this I know how to do)
3. Spit out a csv with the same list of points and the polygon id from
the shapefile, indicating that the point lies within the polygon (i.e.
in the county)
Ive got this to work by manually constructing polygons from a csv
export of the shapefile, but I'm afraid that Im not going to deal very
well with holes in counties, or edge cases. A standard out-of-the-box
solution would be great.
Thanks!
Abhishek
------------
http://abhishek.mit.edu
_______________________________________________
Community mailing list
Community at lists.gispython.org
http://lists.gispython.org/mailman/listinfo/community
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gispython.org/pipermail/community/attachments/20131120/12357eb1/attachment.htm>
Loading...