[mapserver-commits] r12022 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Sat Aug 6 11:33:12 EDT 2011
Author: warmerdam
Date: 2011-08-06 08:33:12 -0700 (Sat, 06 Aug 2011)
New Revision: 12022
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapogroutput.c
Log:
Add support for OGR output of 2.5D geometries (#3906)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2011-08-06 11:39:35 UTC (rev 12021)
+++ trunk/mapserver/HISTORY.TXT 2011-08-06 15:33:12 UTC (rev 12022)
@@ -105,7 +105,9 @@
- Fix GetMapserverUnitUsingProj() for proj=latlong (#3883)
+- Add support for OGR output of 2.5D geometries (#3906)
+
Version 6.0.0 (2011-05-11)
--------------------------
Modified: trunk/mapserver/mapogroutput.c
===================================================================
--- trunk/mapserver/mapogroutput.c 2011-08-06 11:39:35 UTC (rev 12021)
+++ trunk/mapserver/mapogroutput.c 2011-08-06 15:33:12 UTC (rev 12022)
@@ -219,6 +219,8 @@
int i, out_field;
OGRwkbGeometryType eLayerGType, eFeatureGType = wkbUnknown;
+ eLayerGType = OGR_FD_GetGeomType(OGR_L_GetLayerDefn(hOGRLayer));
+
/* -------------------------------------------------------------------- */
/* Transform point geometry. */
/* -------------------------------------------------------------------- */
@@ -236,7 +238,12 @@
OGR_G_SetPoint( hGeom, 0,
shape->line[0].point[0].x,
shape->line[0].point[0].y,
- 0.0 );
+#ifdef USE_POINT_Z_M
+ shape->line[0].point[0].z
+#else
+ 0.0
+#endif
+ );
}
/* -------------------------------------------------------------------- */
@@ -267,7 +274,12 @@
OGR_G_SetPoint( hGeom, i,
shape->line[j].point[i].x,
shape->line[j].point[i].y,
- 0.0 );
+#ifdef USE_POINT_Z_M
+ shape->line[j].point[i].z
+#else
+ 0.0
+#endif
+ );
}
if( hML != NULL )
@@ -317,7 +329,12 @@
OGR_G_SetPoint( hRing, i,
shape->line[iOuter].point[i].x,
shape->line[iOuter].point[i].y,
- 0.0 );
+#ifdef USE_POINT_Z_M
+ shape->line[iOuter].point[i].z
+#else
+ 0.0
+#endif
+ );
}
OGR_G_AddGeometryDirectly( hGeom, hRing );
@@ -338,7 +355,12 @@
OGR_G_SetPoint( hRing, i,
shape->line[iRing].point[i].x,
shape->line[iRing].point[i].y,
- 0.0 );
+#ifdef USE_POINT_Z_M
+ shape->line[iRing].point[i].z
+#else
+ 0.0
+#endif
+ );
}
OGR_G_AddGeometryDirectly( hGeom, hRing );
@@ -397,6 +419,20 @@
#endif /* GDAL/OGR 1.8 or later */
/* -------------------------------------------------------------------- */
+/* Consider flattening the geometry to 2D if we want 2D */
+/* output. */
+/* -------------------------------------------------------------------- */
+ eLayerGType = OGR_FD_GetGeomType(OGR_L_GetLayerDefn(hOGRLayer));
+
+ if( hGeom != NULL )
+ eFeatureGType = OGR_G_GetGeometryType( hGeom );
+
+ if( eLayerGType == wkbFlatten(eLayerGType)
+ && hGeom != NULL
+ && eFeatureGType != wkbFlatten(eFeatureGType) )
+ OGR_G_FlattenTo2D( hGeom );
+
+/* -------------------------------------------------------------------- */
/* Create the feature, and attach the geometry. */
/* -------------------------------------------------------------------- */
hFeat = OGR_F_Create( OGR_L_GetLayerDefn( hOGRLayer ) );
@@ -651,7 +687,21 @@
else if( strcasecmp(value,"MultiPolygon") == 0 )
eGeomType = wkbMultiPolygon;
else if( strcasecmp(value,"GeometryCollection") == 0 )
- eGeomType = wkbMultiPolygon;
+ eGeomType = wkbGeometryCollection;
+ else if( strcasecmp(value,"Point25D") == 0 )
+ eGeomType = wkbPoint25D;
+ else if( strcasecmp(value,"LineString25D") == 0 )
+ eGeomType = wkbLineString25D;
+ else if( strcasecmp(value,"Polygon25D") == 0 )
+ eGeomType = wkbPolygon25D;
+ else if( strcasecmp(value,"MultiPoint25D") == 0 )
+ eGeomType = wkbMultiPoint25D;
+ else if( strcasecmp(value,"MultiLineString25D") == 0 )
+ eGeomType = wkbMultiLineString25D;
+ else if( strcasecmp(value,"MultiPolygon25D") == 0 )
+ eGeomType = wkbMultiPolygon25D;
+ else if( strcasecmp(value,"GeometryCollection25D") == 0 )
+ eGeomType = wkbGeometryCollection25D;
else if( strcasecmp(value,"Unknown") == 0
|| strcasecmp(value,"Geometry") == 0 )
eGeomType = wkbUnknown;
More information about the mapserver-commits
mailing list