[postgis-devel] short question

Paul Ramsey pramsey at cleverelephant.ca
Sat Nov 21 16:42:00 PST 2009


I don't think you should be returning EMPTY in any of your functions,
I think NULL is a reasonable return value for
st_shortestline(empty,empty).

P

On Sat, Nov 21, 2009 at 4:32 PM, Nicklas Avén
<nicklas.aven at jordogskog.no> wrote:
> My first post was just about how to move the information internally that an
> empty geometry should be returned, from my function lw_dist2d_distanceline
> in measures.c to function LWGEOM_shortestline2d in lwgeom_functions_basic,
> when the expected return is LWLINE
>
> But I have realised that the thing is a little bit bigger because I out to
> return the right type externally too.
> Otherwise it will violate constraints if people tries to put the result in a
> table.
>
> Is this solved in other functions like st_union or st_difference?
>
> /Nicklas
>
>
>
> 2009-11-22 Paul Ramsey wrote:
>
> You are constructing empty geometries? Why? (Or is this a question of
>>curiosity?)
>>
> >From an API PoV we should probably make some functions to do this, but
>>the details are, generally, an LWGEOM with a POINTARRAY that has
>>npoints = 0. Or, for collections, a collection with ngeoms = 0. I
>>believe I also consider LWGEOMs with a null POINTARRAY or a null
>>**geoms to be empty, but I'd have to confirm. The exact way of
>>representing empty things was never fully documented
>>
>>P.
>>
>>On Sat, Nov 21, 2009 at 4:13 PM, Nicklas Avén
>> wrote:
>>> OK
>>>
>>> But what to send as empty when LWLINE or LWPOINT is wanted, not
>>> LWCOLLECTION.
>>> internally I mean.
>>> /Nicklas
>>>
>>> 2009-11-22 Paul Ramsey wrote:
>>>
>>> No, bad idea. Empty geometries have a type. There's 'POLYGON EMPTY',
>>>>'LINESTRING EMPTY', etc, etc, etc.
>>>>
>>>>P.
>>>>
>>>>On Sat, Nov 21, 2009 at 2:04 PM, Nicklas Avén
>>>> wrote:
>>>>> is type 0 for LWGEOM occupied by anything or could it be an idea to use
>>>>> it
>>>>> for empty geometries.
>>>>> Then it would be easy to create any emtpy geometry. Like a generic
>>>>> empty
>>>>> geometry.
>>>>>
>>>>> Or is there another way that I have missed.
>>>>>
>>>>> When I have identified the empty geometries, in shortestline and it
>>>>> buddies
>>>>> I need to communicate that an empty geometry should be returned and the
>>>>> datatype is LWLINE and LWPOINT for st_closestpoint. I'm tempted to just
>>>>> make
>>>>> an LWGEOM with type 0. Is it a bad idea.
>>>>>
>>>>> #define EMPTY 0
>>>>> #define POINTTYPE 1
>>>>> #define LINETYPE 2
>>>>> #define POLYGONTYPE 3
>>>>> and so on
>>>>>
>>>>> /Nicklas
>>>>> _______________________________________________
>>>>> 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
>>
>>
> _______________________________________________
> 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