[postgis-devel] What am I missing??

Paul Ramsey pramsey at cleverelephant.ca
Sun Nov 15 10:42:25 PST 2009


The actual allocation of space for these things is handled in a
type-aware way, so that they are properly sized. LWGEOM is just a
superclass so that they can be passed around to different
functionality without having to be aware of what's inside (only the
'type' number has any real important meaning).

The lwcollection_getsubgeom() appears to be doing internally what I
end up writing out anyways, which is collection->geoms[i] to retrieve
the subgeometry. So that's not the source of your crashes (getting a
bad count for numgeoms, on the other hand, would do it).

P.

On Sun, Nov 15, 2009 at 8:24 AM, Nicklas Avén
<nicklas.aven at jordogskog.no> wrote:
> Hallo
>
> I'm trying to get my distance-code working with LWGEOM from early in the
> process. From some hours of frustration I have to ask what I'm missing.
>
> If I look at lwgeom_deserialize()
>  http://postgis.refractions.net/documentation/postgis-doxygen/d3/dc8/lwgeom_8c-source.html#l00022
>
> I see that the function is returning tye LWGEOM
> LWGEOM looks like this:
> typedef struct
> {
>  uchar type;
>  BOX2DFLOAT4 *bbox;
>  uint32 SRID;
>  void *data;
> }
> LWGEOM;
>
> so it needs 16 bytes (?) according to sizeof()
>
> But lwgeom_deserialize is also supposed to return Multigeometries and
> linestrings and polygons. Thosa all have an integer more than LWGEOM.The
> integer number of geometries for Multi geometries and number of rings for
> LWPOLY. That makes those types needing 20 bytes.
>
> I wouldn't dare to say something is wrong here but I get strange server
> crashes when using lwcollection_getsubgeom()
> Since I don't see lwcollection_getsubgeom() is used by any other process I
> get little suspicous that it is not that hard tested.
> I hope I'm just stupid here, but want to find out in what way :-)
>
> Thanks
> Nicklas
>
>
> _______________________________________________
> 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