[postgis-devel] Which intersection is faster?

Bborie Park dustymugs at gmail.com
Sat Mar 23 11:42:57 PDT 2013


Your best bet would be to convert the geometry to an aligned raster
once, cache that raster and then run the intersection test.
Otherwise, things get converted needlessly and repeatedly.

-bborie

On Sat, Mar 23, 2013 at 11:12 AM, Jorge Arévalo
<jorgearevalo at libregis.org> wrote:
> Ok, understood.
>
> The point is I'm trying to make the GDAL PostGIS Raster driver faster, and the main bottleneck is in the intersection between raster columns and user requested window (I construct a polygon from the user's request coords and instersect that polygon with the raster data).
>
> Swapping raster - vector objects was my first (naive) approach. Any (for sure smarter) suggestions are welcome.
>
> --
> Jorge Arevalo
> Freelance developer
>
> http://www.krop.com/jorgearevalo
> http://about.me/jorgeas80
>
> Enviado con Sparrow (http://www.sparrowmailapp.com/?sig)
>
>
> El sábado 23 de marzo de 2013 a las 18:53, Bborie Park escribió:
>
>> There's not too much difference between 2.0 and 2.1. I think the
>> major change is ST_Intersects(raster, geometry) =
>> ST_Intersects(geometry, raster). Basically, if one of the arguments
>> is a geometry, the op is done in geometry space (raster is converted
>> to a set of geometries).
>>
>> -bborie
>>
>> On Sat, Mar 23, 2013 at 10:50 AM, Jorge Arévalo
>> <jorgearevalo at libregis.org (mailto:jorgearevalo at libregis.org)> wrote:
>> > Many thanks for the quick response. I can see is pretty fast. But, what about previous version of PostGIS? Say 2.0. Is there any significant difference between both versions?
>> >
>> > --
>> > Jorge Arevalo
>> > Freelance developer
>> >
>> > http://www.krop.com/jorgearevalo
>> > http://about.me/jorgeas80
>> >
>> > Enviado con Sparrow (http://www.sparrowmailapp.com/?sig)
>> >
>> >
>> > El sábado 23 de marzo de 2013 a las 18:30, Bborie Park escribió:
>> >
>> > > I'd suggest using the variant that runs in raster space. If I
>> > > remember correctly, some changes have been made to this in 2.1.
>> > >
>> > > -bborie
>> > >
>> > > On Sat, Mar 23, 2013 at 10:20 AM, Jorge Arévalo
>> > > <jorgearevalo at libregis.org (mailto:jorgearevalo at libregis.org)> wrote:
>> > > > Hello,
>> > > >
>> > > > I don't know if this is a naive question, but in ST_Intersects description (http://postgis.net/docs/manual-2.0/RT_ST_Intersects.html) I read:
>> > > >
>> > > > "Depending on the order that the raster and geometry is passed to ST_Intersects(), the test will operate in either raster-space or geometry-space. If ST_Intersects(raster, ....), the test is in raster-space (the geometry is converted to a raster). If ST_Intersects(geometry, ...), the test is in geometry-space (the raster is converted to a set of pixel polygons)."
>> > > >
>> > > > My question: in equal conditions, which version should be faster?
>> > > >
>> > > > ST_Intersects(raster, vector) --> in raster space
>> > > > ST_Intersects(vector, raster) --> in vector space
>> > > >
>> > > > Many thanks in advance,
>> > > >
>> > > > --
>> > > > Jorge Arevalo
>> > > > Freelance developer
>> > > >
>> > > > http://www.krop.com/jorgearevalo
>> > > > http://about.me/jorgeas80
>> > > >
>> > > > Enviado con Sparrow (http://www.sparrowmailapp.com/?sig)
>> > > >
>> > > >
>> > > > _______________________________________________
>> > > > postgis-devel mailing list
>> > > > postgis-devel at lists.osgeo.org (mailto:postgis-devel at lists.osgeo.org)
>> > > > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>> > >
>> > >
>> > >
>> > >
>> > > _______________________________________________
>> > > postgis-devel mailing list
>> > > postgis-devel at lists.osgeo.org (mailto:postgis-devel at lists.osgeo.org)
>> > > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>> >
>> >
>> >
>> >
>> >
>> > _______________________________________________
>> > postgis-devel mailing list
>> > postgis-devel at lists.osgeo.org (mailto:postgis-devel at lists.osgeo.org)
>> > http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>>
>>
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at lists.osgeo.org (mailto:postgis-devel at lists.osgeo.org)
>> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel
>
>
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel



More information about the postgis-devel mailing list