[Gdal-dev] ogr.py Intersect with wkbGeometryCollection
Frank Warmerdam
fwarmerdam at gmail.com
Thu May 5 18:49:54 EDT 2005
On 5/5/05, Ryan, Adam <ARyan at co.linn.or.us> wrote:
> The goal for me is to write a generic theme-on-theme spatial query method,
> where you would pass an ogrQueryLayer and an ogrSelectLayer with a
> selectList (of record indexes obtained from a previous query that likely
> involved mapscript and not ogr directly) and a method (for this test I just
> do an intersect) and a mode (new, and, or, xor, not - for later) and
> optionally an queryList(again, later).
>
> This test is a step towards that goal. Any advice on how to optimize for
> speed would be greatly appreciated (including rewriting using a whole
> different approach).
Adam,
I'm afraid I only skimmed the script. A few thoughts:
o Union is pretty expensive.
o The spatial filter you end up with is going to be pretty complex I
think, so it will be quite expensive to evaluate whether things
intersect it. I would suggest just setting an MBR rectangle for the
spatial filter. When you do your later Intersect() you can discard
NULL results.
o In general speed is not GEOS's forte, and your could end up asking
it to evaluate some pretty hard operations.
> But first, one comment about pymod.ogr.Geometry.Empty().
> When I try:
> selectPoly.Empty()
> I get:
> TypeError: Empty() takes exactly 2 arguments (1 given)
> If I change ogr.py from:
> def Empty( self, other_geom ):
> return _gdal.OGR_G_Empty( self._o, other_geom._o )
> to:
> def Empty( self ): # , other_geom ):
> return _gdal.OGR_G_Empty( self._o ) # , other_geom._o )
> It seems to work.
Indeed, this was a bug in ogr.py. I have applied the change in CVS.
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent
More information about the Gdal-dev
mailing list