[postgis-users] ST_Intersects differing results

Paul Ramsey pramsey at cleverelephant.ca
Wed May 25 06:10:37 PDT 2016


If your data model expects strict containment (all parcels must be in
only one zone) then the simplest thing is to proxy the parcel polygon
with a point, then you get a guaranteed 1:1 relationship between
parcel and zone. Using ST_PointOnSurface() is required since
ST_Centroid() is not guaranteed to fall within the polygon argument.

SELECT parcel.id, zone.id FROM parcel JOIN zone ON
ST_Contains(zone.geom, ST_PointOnSurface(parcel.geom));

P.

On Wed, May 25, 2016 at 2:43 AM, Rémi Cura <remi.cura at gmail.com> wrote:
> Hey, if you want to do it the robust way,
> you can use a shared surface distance :
> for instance, ST_area(ST_Intersection(A,B)) / ST_Area(A)
> where A is you polygon, and B  your zoning information.
>
> If everything is snapped, you could also use topology.
>
> Cheers,
>
> Rémi-C
>
> 2016-05-25 3:45 GMT+02:00 Paul Norman <penorman at mac.com>:
>>
>> On 5/24/2016 6:31 PM, Timothy Asquith wrote:
>>>
>>>     - I’m experimenting with ST_Snap and filtering out ST_Touches, but it
>>> still returning the same 3 results
>>
>>
>> You may want to use the dimensionally extended 9 intersection model
>> (http://postgis.net/docs/manual-2.2/using_postgis_dbmanagement.html#DE-9IM)
>> if there isn't a function that expresses what you want.
>>
>> Be sure to add a geom1 && geom2 condition if applicable so you get index
>> usage.
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/postgis-users
>
>
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/postgis-users


More information about the postgis-users mailing list