[postgis-devel] ST_GeometrySplit

Chris Hodgson chodgson at refractions.net
Wed Mar 10 11:04:59 PST 2010


ST_Difference, according to IBM:

http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb.spatial.doc/rsbp4035.html

"Both [input] geometries must be of the same dimension."

However, I don't see any use to the results of the existing 
implementation for non-equal dimension geometries... if it is possible, 
it might be nice to just make ST_difference "work" for these cases 
rather than introduce another function with virtually identical results. 
Though I suppose the intention of "splitting" is different enough from 
"subtracting" to perhaps warrant a separate function. Also I don't know 
if the behavior of st_difference in the case of non-equal dimension 
inputs is specified in SQL_MM or otherwise.

Chris


Chris Hodgson wrote:
> Works for the line case though:
>
> select st_astext(st_difference( st_geomfromtext('LINESTRING(0 0, 0 
> 2)'), st_geomfromtext('LINESTRING(-1 1, 1 1)')));
>              st_astext              
> --------------------------------------
> MULTILINESTRING((0 0,0 1),(0 1,0 2))
>
> Perhaps the point case is a precision issue? Or I don't know the exact 
> spec for this function.
>
> Not the result I expect for the polygon-line case either:
>
> select st_astext(st_difference( st_geomfromtext('POLYGON((0 0, 0 2, 2 
> 0, 0 0))'), st_geomfromtext('LINESTRING(-1 1, 2 1)')));
>             st_astext             ------------------------------------
> POLYGON((0 0,0 1,0 2,1 1,2 0,0 0))
>
> I'm running on old stuff here, maybe someone can check on a newer 
> version...
>
> select postgis_full_version();
>                                
> postgis_full_version                                
> ------------------------------------------------------------------------------------- 
>
> POSTGIS="1.3.3" GEOS="3.0.0-CAPI-1.4.1" PROJ="Rel. 4.6.1, 21 August 
> 2008" USE_STATS
>
> Chris
>
>
> Chris Hodgson wrote:
>> Hmm... nevermind, I guess it's not.
>>
>> select st_astext(st_difference( st_geomfromtext('LINESTRING(0 0, 0 
>> 2)'), st_geomfromtext('POINT(0 1)')));
>>      st_astext     ---------------------
>> LINESTRING(0 0,0 2)
>>
>> Chris
>>
>> Chris Hodgson wrote:
>>> Isn't this the same as st_difference(A,B), when given any of those 
>>> pairs of arguments? Wrap it in an st_dump() if you want to separate 
>>> the individual results?
>>>
>>> Chris
>>>
>>> strk wrote:
>>>> Brain picking you guys about a ST_GeometrySplit.
>>>>
>>>> The cases of interest seem to be:
>>>>  - Split polygon by line
>>>>  - Split line by line
>>>>  - Split line by point
>>>>
>>>> Initial questions:
>>>>  - Should we allow multi-segment "blade" lines ?
>>>>    (where a single polygon or line might be cut in multiple pieces)
>>>>  - Should we allow multi-component inputs ?
>>>>    (where the "blade" might cut a single component)
>>>>
>>>> Both questions are related to the kind of returned output,
>>>> that is: should output be always composed by 2 parts or
>>>> possibly multiple parts ?
>>>>
>>>> Comments welcome.
>>>>
>>>> --strk;
>>>>
>>>>   ()   Free GIS & Flash consultant/developer
>>>>   /\   http://strk.keybit.net/services.html
>>>> _______________________________________________
>>>> postgis-devel mailing list
>>>> postgis-devel at postgis.refractions.net
>>>> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>>>>   
>>>
>>> _______________________________________________
>>> postgis-devel mailing list
>>> postgis-devel at postgis.refractions.net
>>> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>>
>> _______________________________________________
>> postgis-devel mailing list
>> postgis-devel at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel




More information about the postgis-devel mailing list