[Gdal-dev] How determine if lat\lon point falls within a shapefile

Jim St.Cyr jim.stcyr at gmail.com
Sat Feb 23 19:51:38 EST 2008



The shapefiles do use the same lat\lon coordinate system.  What I've been
struggling with is performing the actual point-in-polygon or
point-in-bounding-box check.  I've found formulas and packages such as 'sp'
for 'R' but have yet to find something that ties it all together.  Open the
shapefile and then for each point get a yes or no answer or alternatively
for a multi layer scenario be told which areas within the overall map a
position falls within.  A vendor we work with does it using MapInfo or ESRI
runtimes but I would like to use a python based, OSS solution if possible.

Thanks for the reply.

Jim


Tom Kazimiers wrote:
> 
> Jim St.Cyr schrieb:
>> I have a shapefile and a list of lat\long's that I would like to process
>> in
>> order to determine if they fall within the shapefile.  GDAL-1.5-py2.5 is
>> loaded on a windows XP machine and is correctly configured.  I would
>> appreciate it if someone could point me to a python script or appropriate
>> documentation to get me strted.  At this point I can't even determine
>> which
>> part of the GDAL package to use....
>>
>> Thanks much.
>>
>> Jim
>>   
> Is the data of the shapefile also referenced with lat\long values of the 
> same geographic coordinate system or do you need to translate them?
> I think you could open the shapefile, get the bounding box stored in the 
> file (maybe you have to go through all the shapes as the stored bounding 
> box in the file must not be correct - at least I do this when loading 
> shapefiles) and then compare it to your value.
> 
> bye,
> Tom
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/How-determine-if-lat%5Clon-point-falls-within-a-shapefile-tp15618562p15659292.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.



More information about the gdal-dev mailing list