[postgis-tickets] [PostGIS] #4979: There are still problems with geographies

PostGIS trac at osgeo.org
Sun Aug 22 01:52:38 PDT 2021


#4979: There are still problems with geographies
-----------------------+---------------------------
  Reporter:  ezimanyi  |      Owner:  pramsey
      Type:  defect    |     Status:  reopened
  Priority:  medium    |  Milestone:  PostGIS 3.1.4
 Component:  postgis   |    Version:  2.5.x
Resolution:            |   Keywords:
-----------------------+---------------------------

Comment (by ezimanyi):

 When I execute

 {{{
 test_pg3=# select postgis_full_version();
 postgis_full_version

 ------------------------------------------------------------------------------------------------------------------------
 ----------------------------------------------
  POSTGIS="3.1.3 008d2db" [EXTENSION] PGSQL="130" GEOS="3.8.0-CAPI-1.13.1 "
 PROJ="6.3.1" LIBXML="2.9.10" LIBJSON="0.13.1"
  LIBPROTOBUF="1.3.3" WAGYU="0.5.0 (Internal)"
 (1 row)

 test_pg3=# select geography 'Point(1 1)';
 }}}

 the trace of the problem with gdb is as follows

 {{{
 Breakpoint 1, geography_in (fcinfo=0x55f900000001) at
 geography_inout.c:138
 138     {
 (gdb) n
 139             char *str = PG_GETARG_CSTRING(0);
 (gdb)
 141             int32 geog_typmod = -1;
 (gdb)
 143             LWGEOM *lwgeom = NULL;
 (gdb)
 144             GSERIALIZED *g_ser = NULL;
 (gdb)
 146             if ( (PG_NARGS()>2) && (!PG_ARGISNULL(2)) ) {
 (gdb)
 147                     geog_typmod = PG_GETARG_INT32(2);
 (gdb)
 150             lwgeom_parser_result_init(&lwg_parser_result);
 (gdb)
 153             if ( str[0] == '\0' )
 (gdb)
 157             if ( str[0] == '0' )
 (gdb)
 168                     if ( lwgeom_parse_wkt(&lwg_parser_result, str,
 LW_PARSER_CHECK_ALL) == LW_FAILURE )
 (gdb)
 171                     lwgeom = lwg_parser_result.geom;
 (gdb)
 175             srid_check_latlong(lwgeom->srid);
 (gdb) p lwg_parser_result
 $11 = {wkinput = 0x55f954a87f00 "Point(1 1)", serialized_lwgeom = 0x0,
 size = 0, geom = 0x55f954a88638, message = 0x0,
   errcode = 0, errlocation = 0, parser_check_flags = 7}
 (gdb) p *lwgeom
 $12 = {bbox = 0x0, data = 0x55f954a885b8, srid = 0, flags = 0, type = 1
 '\001', pad = ""}
 (gdb) p *((LWPOINT *)lwgeom)
 $13 = {type = 0 '\000', flags = 0 '\000', bbox = 0x55f954a885b8, srid = 0,
 point = 0x0}
 (gdb) p sizeof(LWGEOM)
 $14 = 24
 (gdb) p sizeof(LWPOINT)
 $15 = 32
 (gdb) n
 178             g_ser = gserialized_geography_from_lwgeom(lwgeom,
 geog_typmod);
 (gdb) s
 gserialized_geography_from_lwgeom (lwgeom=0xc2ecd637, geog_typmod=1) at
 geography_inout.c:90
 90      {
 (gdb) n
 91              GSERIALIZED *g_ser = NULL;
 (gdb)
 94              lwgeom_set_geodetic(lwgeom, true);
 (gdb) s
 lwgeom_set_geodetic (geom=0x55f954a885a0, value=32767) at lwgeom.c:953
 953     {
 (gdb) n
 960             FLAGS_SET_GEODETIC(geom->flags, value);
 (gdb)
 961             if ( geom->bbox )
 (gdb)
 962                     FLAGS_SET_GEODETIC(geom->bbox->flags, value);
 (gdb)
 964             switch(geom->type)
 (gdb) p geom->type
 $16 = 0 '\000'
 (gdb) p *geom
 $17 = {type = 0 '\000', flags = 8 '\b', bbox = 0x55f954a885b8, srid = 0,
 data = 0x0}
 (gdb)
 }}}
 What is strange are the sizes of LWGEOM vs LWPOINT reported (24 vs 32). Is
 there a problem with the alignment ?

-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/4979#comment:5>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list