Opened 18 years ago

Closed 18 years ago

#1646 closed defect (fixed)

display problem w/ antimeridian-crossing SDO_GEOMETRY polygon

Reported by: john.c.cartwright@… Owned by: warmerdam
Priority: high Milestone:
Component: Input - Native Oracle Spatial Support Version: 4.8
Severity: normal Keywords:
Cc: fsimon@…

Description

Hello,

I have a test polygon which crosses the antimeridian and does not display
correctly either in an unprojected map (WGS84) or orthographic projection.  In
the geographic, the polygon incorrectly "wraps" around the earth in the
longitude direction.  In the orthographic projection, the polygon does not
display at all. This may be related to resolved bug 411.

The SQL listed below describes the construction of the test polygons and listed
below that are two simple map files illustrating the usage of the polygons in a
geographic and orthographic.

Mapserver version 4.8.1; RHEL ES 3

Thanks!

----
create table poly_tst (OBJECTID NUMBER, NAME VARCHAR2(128), SHAPE
MDSYS.SDO_GEOMETRY);
insert into poly_tst values (
   1,
   'antimeridian-crossing polygon',
    MDSYS.SDO_GEOMETRY(
       2003,
       8307,
       NULL,
       SDO_ELEM_INFO_ARRAY(1, 1003, 1),
       SDO_ORDINATE_ARRAY(160, -10, -160, -10, -160, 10, 160, 10, 160, -10)
   )
);

insert into poly_tst values (
   2,
   'control polygon',
   SDO_GEOMETRY(
      2003,
      8307,
      NULL,
      SDO_ELEM_INFO_ARRAY(1, 1003, 1),
      SDO_ORDINATE_ARRAY(-170, 20, -150, 20, -150, 30, -170, 30, -170, 20)
   )
);
insert into user_sdo_geom_metadata values (
   'POLY_TST',
   'SHAPE',
   MDSYS.SDO_DIM_ARRAY(
      MDSYS.SDO_DIM_ELEMENT('Longitude',-180,180,0.5),
      MDSYS.SDO_DIM_ELEMENT('Latitude',-90,90,0.5)
   ),
   8307
);
create index poly_tst_spidx on poly_tst(SHAPE) indextype is MDSYS.SPATIAL_INDEX;

---
MAP
   NAME world
   IMAGETYPE GIF
   TRANSPARENT true

  EXTENT -180 -90 180 90
   SHAPEPATH "/extra/data/shapefiles"
   PROJECTION
     "init=epsg:4326"
   END

   LAYER
      NAME AntiMeridian
      CONNECTIONTYPE oraclespatial
      CONNECTION "oracle_user/oracle_pass@oracle_host.ngdc.noaa.gov"
      DATA "SHAPE FROM oracle_user.poly_tst USING SRID 8307"

      STATUS on
      TYPE polygon
      CLASS
         COLOR 167 167 167
         OUTLINECOLOR 0 0 0
      END

      PROJECTION
         "init=epsg:4326"
      END
   END
END

----

MAP
   NAME world
   IMAGETYPE GIF
   TRANSPARENT true

   EXTENT -6500 -6500 6500 6500
   PROJECTION
       "+proj=geos"
       "+lat_0=0.0"
       "+lon_0=-75.0"
       "+a=6378.137"
       "+b=6356.7533"
       "+h=35680"
   END

   LAYER
      NAME AntiMeridian
      CONNECTIONTYPE oraclespatial
      CONNECTION "oracle_user/oracle_pass@oracle_host.ngdc.noaa.gov"
      DATA "SHAPE FROM oracle_user.poly_tst USING SRID 8307"

      STATUS on
      TYPE polygon
      CLASS
         COLOR 167 167 167
         OUTLINECOLOR 0 0 0
      END

      PROJECTION
         "init=epsg:4326"
      END
   END

END

Change History (5)

comment:1 by john.c.cartwright@…, 18 years ago

Further experiments using an inline polygon suggest that the problem may *not*
be related to oracle. The following layer also displays incorrectly in lon/lat
display and not at all in ortho projection.

   LAYER
      NAME inline
      TYPE POLYGON
      STATUS DEFAULT
      FEATURE
        POINTS
            160 -10
           -160 -10
           -160  10
            160  10
           -160 -10
        END
      END
      CLASS
         COLOR 167 167 167
         OUTLINECOLOR 0 0 0
      END
      PROJECTION
         "init=epsg:4326"
      END
   END



comment:2 by fwarmerdam, 18 years ago

Cc: fsimon@… added
Owner: changed from fsimon@… to fwarmerdam
Hi Frank,

sorry - I misunderstood what you were asking for. Attached are two mapfiles
using an inline polygon of the same dimensions. Results are approximately the
same (suggesting that oracle spatial may *not* be the problem) with the lon/lat
display incorrectly wrapping the globe and the ortho not displaying at all. 
However, the lon/lat display was somewhat different that w/ the oracle spatial
datasource - the rectange is split diagonally.

Thanks again for your help!

-- john



MAP
   NAME world
   IMAGETYPE GIF
   TRANSPARENT true

  EXTENT -180 -90 180 90
   SHAPEPATH "/extra/data/shapefiles"        
   PROJECTION
     "init=epsg:4326"
   END
  
   LAYER
      NAME inline
      TYPE POLYGON
      STATUS DEFAULT
      FEATURE
        POINTS
            160 -10
           -160 -10
           -160  10
            160  10
           -160 -10
        END
      END
      CLASS
         COLOR 167 167 167
         OUTLINECOLOR 0 0 0
      END
      PROJECTION
         "init=epsg:4326"
      END
   END

END 


----


MAP
   NAME world
   IMAGETYPE GIF
   TRANSPARENT true

   EXTENT -6500 -6500 6500 6500
   PROJECTION
       "+proj=geos"
       "+lat_0=0.0"
       "+lon_0=-75.0"
       "+a=6378.137"
       "+b=6356.7533"
       "+h=35680"
   END
  
   LAYER
      NAME inline
      TYPE POLYGON
      STATUS DEFAULT
      FEATURE
        POINTS
            160 -10
           -160 -10
           -160  10
            160  10
           -160 -10
        END
      END
      CLASS
         COLOR 167 167 167
         OUTLINECOLOR 0 0 0
      END
      PROJECTION
         "init=epsg:4326"
      END
   END

END 


comment:3 by fsimon@…, 18 years ago

Hi all,
I created some examples to help to find the problem. I created the Oracle and 
Inline layers. I just used the epsg:4326 because I don't have the GEOS proj.

Oracle connection with normal definition:
http://200.169.63.95/cgi-bin/map481?
map=/home/apache/mapserv/debug.map&imgsize=555+555&mode=map&layers=AntiMeridian

Oracle connection with NONE definition:
http://200.169.63.95/cgi-bin/map481?
map=/home/apache/mapserv/debug.map&imgsize=555+555&mode=map&layers=AntiMeridian
_NONE

Oracle connection with RELATE definition:
http://200.169.63.95/cgi-bin/map481?
map=/home/apache/mapserv/debug.map&imgsize=555+555&mode=map&layers=AntiMeridian
_RELATE

Inline definition:
http://200.169.63.95/cgi-bin/map481?
map=/home/apache/mapserv/debug.map&imgsize=555+555&mode=map&layers=inline

For inline defition I changes the features to close the polygon:
FEATURE
POINTS
    160 -10
   -160 -10
   -160  10
    160  10
   160 -10
END
END

Best regards.

comment:4 by fsimon@…, 18 years ago

Sorry,
I forgor to add the data definition:
AntiMeridian:
DATA "SHAPE FROM poly_tst USING SRID 8307"

AntiMeridian_NONE:
DATA "SHAPE FROM FROM poly_tst USING SRID 8307 NONE"

AntiMeridian_RELATE:
DATA "SHAPE FROM poly_tst USING SRID 8307 RELATE"

Best regards

comment:5 by fwarmerdam, 18 years ago

Resolution: fixed
Status: newclosed
OK, I verified the "stretched across the world" problem with the
first map.  I don't really see anything that can be done about that.

For the second case, I found that the default bounds did not include the
dateline crossing rectangle.  If you do the following (note the central meridian
for projection moved close to the rectangle) it seems to render just fine.

MAP
   NAME world
   IMAGETYPE png8_t
#   TRANSPARENT true
   EXTENT -6500 -6500 6500 6500
#   EXTENT -2500 -2500 2500 2500
   SIZE 500 500 
   IMAGECOLOR 255 255 0

   PROJECTION
       "+proj=geos"
       "+lat_0=0.0"
#       "+lon_0=-75.0"
       "+lon_0=-155.0"
       "+a=6378.137"
       "+b=6356.7533"
       "+h=35680"
   END
  
   OUTPUTFORMAT
     NAME png8_t
     DRIVER "GDAL/PNG"
     IMAGEMODE PC256
     TRANSPARENT OFF
   END

   LAYER
      NAME inline
      TYPE POLYGON
      STATUS DEFAULT
      FEATURE
        POINTS
            160 -10
           -160 -10
           -160  10
            160  10
            160 -10
        END
      END
      CLASS
         COLOR 167 167 167
         OUTLINECOLOR 0 0 0
      END
      PROJECTION
         "init=epsg:4326"
      END
   END

END 

The output to GDAL/PNG isn't critical.  It just allowed me (with GDAL PAM
support turned on) to capture the projection and bounds info on the output
file. 

So, as far as I can tell, everything is working OK.  

I'm marking this as WORKSFORME.  Please re-open it if you feel there
is a concrete bug here that should be fixed. 

Note: See TracTickets for help on using tickets.