Created
December 8, 2010 12:13
-
-
Save jgomezdans/733207 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from osgeo import ogr | |
# First, define our point. Using WKT, but could use a OGR source or something | |
my_point = ogr.CreateGeometryFromWkt( \ | |
"POINT( 224021.425476915, 4114664.1465754998)" ) | |
dataset = ogr.Open ( FILENAME ) | |
layer = dataset.GetLayer ( 0 ) # Or whatever it is you require | |
# You may also want to apply some spatial subsetting to the layer here | |
# Loop over features | |
for feat in layer: | |
geom = feat.GetGeometryRef() | |
if geom.Contains ( my_point ): | |
# Do something with it: add to some dataset, report etc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment