Opened 18 years ago

Closed 18 years ago

#1535 closed defect (worksforme)

Mapserver postgis driver unable to read EWKB properly

Reported by: szekerest Owned by: refractions
Priority: high Milestone:
Component: PostGIS Interface Version: 4.6
Severity: critical Keywords:
Cc:

Description

Mapserver postgis driver unable to read EWKB properly, eg. geometries with 
embedded SRID.
(For example after using ogr2ogr with -a_srs parameter to load data into a
postgis table).

I haven't found a documentation about postgis EWKB representation only a 
proposal at:

http://postgis.refractions.net/pipermail/postgis-devel/2004-
December/000710.html

it seems that EWKB stores extra information in the upper bits of the geometry
type (eg. SRID presence flag) which have't taken into account by
mapserver, so the geometries will not be displayed at all.

The problem might be corrected by applying a mask on the upper bits in 
mappostgis.c before checking the type of the feature. For example

at line 938

if(type == 3) {
            /* polygon */
            shape->type = MS_SHAPE_POLYGON;

might be replaced with

if(type & 0x1FFFFFFF == 3) {
            /* polygon */
            shape->type = MS_SHAPE_POLYGON; 

Tamas Szekeres

Change History (8)

comment:1 by fwarmerdam, 18 years ago

Cc: warmerdam@… added
Tamas,  

Can you confirm that this problem still exists with MapServer 4.8? 
What version of PostGIS are you using?  

comment:2 by szekerest, 18 years ago

Frank,

The nightly build still contains this issue.

I forgot to note that not only the extension bits but the presence of the 
extra fields should also be taken into account when correcting this problem...

Tamas

comment:3 by szekerest, 18 years ago

I am using pginstaller 8.0.4 for Windows with postgis support installed.

Tamas

comment:4 by m.cave-ayland@…, 18 years ago

Hi Tamas,

Can you confirm the version of PostGIS you are using with SELECT
postgis_full_version()? Note that the mapserver postgis driver doesn't deal with
EWKB because it does a SELECT AsBinary(geom).... where AsBinary() returns the
OGC WKB-compliant geometry which is the geometry without any extras such as
SRID, Z, and M points. So something else must be going on here...


Mark.

comment:5 by szekerest, 18 years ago


Mark,

This problem exists with this version:

"POSTGIS="1.0.0RC2" GEOS="2.1.1" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS 
DBPROC="0.1.0" RELPROC="0.1.0"

but actually does not exists with

"POSTGIS="1.0.4" GEOS="2.1.4" PROJ="Rel. 4.4.9, 29 Oct 2004" USE_STATS 
DBPROC="0.3.0" RELPROC="0.3.0"

Tamas

comment:6 by m.cave-ayland@…, 18 years ago

Hi Tamas,

If it works with 1.0.4 then it is likely something that we have fixed between
1.0.0RC2 and 1.0.4, and so if you agree I think we can close this bug.


Mark.

comment:7 by szekerest, 18 years ago


OK,

Tamas

comment:8 by fwarmerdam, 18 years ago

Resolution: worksforme
Status: newclosed
It looks like this was a transitional problem, and not needing
any fixes in mapserver.
Note: See TracTickets for help on using tickets.