MapServer / MapServer

Source code of the MapServer project. Please submit pull requests to the 'main' branch.
https://mapserver.org
Other
1.02k stars 371 forks source link

Mapserver postgis driver unable to read EWKB properly #1535

Closed mapserver-bot closed 12 years ago

mapserver-bot commented 12 years ago

Reporter: szekerest Date: 2005/11/23 - 00:05 Trac URL: http://trac.osgeo.org/mapserver/ticket/1535

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
mapserver-bot commented 12 years ago

Author: fwarmerdam Date: 2005/11/23 - 00:22

Tamas,  

Can you confirm that this problem still exists with MapServer 4.8? 
What version of PostGIS are you using?  
mapserver-bot commented 12 years ago

Author: szekerest Date: 2005/11/23 - 00:37

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
mapserver-bot commented 12 years ago

Author: szekerest Date: 2005/11/23 - 00:45

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

Tamas
mapserver-bot commented 12 years ago

Author: m.cave-ayland@webbased.co.uk Date: 2005/11/23 - 09:45

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.
mapserver-bot commented 12 years ago

Author: szekerest Date: 2005/11/23 - 19:07


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
mapserver-bot commented 12 years ago

Author: m.cave-ayland@webbased.co.uk Date: 2005/11/23 - 19:42

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.
mapserver-bot commented 12 years ago

Author: szekerest Date: 2005/11/23 - 20:05


OK,

Tamas
mapserver-bot commented 12 years ago

Author: fwarmerdam Date: 2005/12/01 - 19:15

It looks like this was a transitional problem, and not needing
any fixes in mapserver.