[gdal-dev] OGR Select Features by Location...
Roger André
randre at gmail.com
Tue Jan 22 21:49:53 EST 2008
I think that if you built GDAL with GEOS support, you can call on the GEOS
methods from directly within your ogr objects. (Not sure I'm saying that
right) There is an example here -
http://mapserver.gis.umn.edu/community/conferences/MUM3/workshop/python/geometriespdf
Code in the example looks something like this:
#! /usr/bin/python
import ogr
r1 = {'minx': -5.0, 'miny': 0.0, 'maxx': 5.0, 'maxy':10.0}
r2 = {'minx': 0.0, 'miny': -5.0, 'maxx': 10.0, 'maxy':5.0}
template = 'POLYGON ((%(minx)f %(miny)f, %(minx)f %(maxy)f, %(maxx)f %(maxy)
f, %(maxx)f %(miny)f, %(minx)f %(miny)f))'
w1 = template % r1
w2 = template % r2
g1 = ogr.CreateGeometryFromWkt(w1)
g2 = ogr.CreateGeometryFromWkt(w2)
inter = g1.Intersection(g2) # <---------------GEOS Intersection command?
print inter
--
On Jan 22, 2008 11:31 AM, Brian Hamlin <maplabs at light42.com> wrote:
> thats a good application of PostGIS
> I think people can do it with GEOS directly, but I have not written
> that myself
>
> -Brian
>
>
> On Jan 22, 2008, at 10:40 AM, estrada.adam at gmail.com wrote:
>
> > All,
> > I have quite a bit of LIDAR data that has been converted to point
> > shapefiles. I need to select all the points that intersect with
> > another polygon shapefile and then write those features to another
> > layer (shapefile). ArcGIS will definitely do it but I am afraid that
> > my machine is not beefy enough to handle LIDAR-sized datasets so I was
> > wondering if anyone knew of some functionality in OGR lib that would
> > do this for me? I cannot seem to figure out how to select by location
> > with the set of tools that are available i.e ogr2ogr...
> >
> > Many thanks in advance,
> > AWE
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20080122/f45b301e/attachment.html
More information about the gdal-dev
mailing list