[mapserver-commits] r7718 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Fri Jun 20 08:31:29 EDT 2008
Author: tomkralidis
Date: 2008-06-20 08:31:29 -0400 (Fri, 20 Jun 2008)
New Revision: 7718
Modified:
trunk/mapserver/HISTORY.TXT
trunk/mapserver/mapows.c
trunk/mapserver/mapows.h
trunk/mapserver/mapwfs.c
trunk/mapserver/mapwms.c
Log:
WFS: project LatLongBoundingBox if required (#2579)
Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT 2008-06-20 02:42:51 UTC (rev 7717)
+++ trunk/mapserver/HISTORY.TXT 2008-06-20 12:31:29 UTC (rev 7718)
@@ -12,6 +12,8 @@
Current Version (SVN trunk):
----------------------------
+- WFS: project LatLongBoundingBox if required (#2579)
+
- SOS: generate error for some invalid filters (#2604)
- SLD: Use style's width paramater when generating sld (#1192)
Modified: trunk/mapserver/mapows.c
===================================================================
--- trunk/mapserver/mapows.c 2008-06-20 02:42:51 UTC (rev 7717)
+++ trunk/mapserver/mapows.c 2008-06-20 12:31:29 UTC (rev 7718)
@@ -1169,22 +1169,29 @@
*/
void msOWSPrintLatLonBoundingBox(FILE *stream, const char *tabspace,
rectObj *extent, projectionObj *srcproj,
- int nService)
+ projectionObj *wfsproj, int nService)
{
const char *pszTag = "LatLonBoundingBox"; /* The default for WMS */
- rectObj ll_ext;
+ rectObj ext;
- ll_ext = *extent;
+ ext = *extent;
- if (srcproj->numargs > 0 && !pj_is_latlong(srcproj->proj)) {
- msProjectRect(srcproj, NULL, &ll_ext);
+ if (nService == OWS_WMS) { /* always project to lat long */
+ if (srcproj->numargs > 0 && !pj_is_latlong(srcproj->proj)) {
+ msProjectRect(srcproj, NULL, &ext);
+ }
}
- if (nService == OWS_WFS)
+ if (nService == OWS_WFS) {
pszTag = "LatLongBoundingBox";
+ if (wfsproj) {
+ if (msProjectionsDiffer(srcproj, wfsproj) == MS_TRUE)
+ msProjectRect(srcproj, wfsproj, &ext);
+ }
+ }
msIO_fprintf(stream, "%s<%s minx=\"%g\" miny=\"%g\" maxx=\"%g\" maxy=\"%g\" />\n",
- tabspace, pszTag, ll_ext.minx, ll_ext.miny, ll_ext.maxx, ll_ext.maxy);
+ tabspace, pszTag, ext.minx, ext.miny, ext.maxx, ext.maxy);
}
/*
Modified: trunk/mapserver/mapows.h
===================================================================
--- trunk/mapserver/mapows.h 2008-06-20 02:42:51 UTC (rev 7717)
+++ trunk/mapserver/mapows.h 2008-06-20 12:31:29 UTC (rev 7718)
@@ -265,7 +265,7 @@
const char *default_value);
void msOWSPrintLatLonBoundingBox(FILE *stream, const char *tabspace,
rectObj *extent, projectionObj *srcproj,
- int nService);
+ projectionObj *wfsproj, int nService);
void msOWSPrintBoundingBox(FILE *stream, const char *tabspace,
rectObj *extent,
projectionObj *srcproj,
Modified: trunk/mapserver/mapwfs.c
===================================================================
--- trunk/mapserver/mapwfs.c 2008-06-20 02:42:51 UTC (rev 7717)
+++ trunk/mapserver/mapwfs.c 2008-06-20 12:31:29 UTC (rev 7718)
@@ -205,6 +205,9 @@
int msWFSDumpLayer(mapObj *map, layerObj *lp)
{
rectObj ext;
+ const char *pszWfsSrs = NULL;
+ projectionObj poWfs;
+ int result = 0;
msIO_printf(" <FeatureType>\n");
@@ -242,31 +245,35 @@
if (msOWSGetEPSGProj(&(map->projection),&(map->web.metadata),"FO",MS_TRUE) != NULL)
{
/* Map has a SRS. Use it for all layers. */
- msOWSPrintEncodeParam(stdout, "(at least one of) MAP.PROJECTION, LAYER.PROJECTION or wfs_srs metadata",
- msOWSGetEPSGProj(&(map->projection),&(map->web.metadata),"FO",MS_TRUE),
- OWS_WARN, " <SRS>%s</SRS>\n", NULL);
+ pszWfsSrs = msOWSGetEPSGProj(&(map->projection),&(map->web.metadata), "FO", MS_TRUE);
}
else
{
/* Map has no SRS. Use layer SRS or produce a warning. */
- msOWSPrintEncodeParam(stdout, "(at least one of) MAP.PROJECTION, LAYER.PROJECTION or wfs_srs metadata",
- msOWSGetEPSGProj(&(lp->projection), &(lp->metadata), "FO", MS_TRUE),
- OWS_WARN, " <SRS>%s</SRS>\n", NULL);
+ pszWfsSrs = msOWSGetEPSGProj(&(map->projection),&(map->web.metadata), "FO", MS_TRUE);
}
+ msOWSPrintEncodeParam(stdout, "(at least one of) MAP.PROJECTION, LAYER.PROJECTION or wfs_srs metadata",
+ pszWfsSrs, OWS_WARN, " <SRS>%s</SRS>\n", NULL);
+
/* If layer has no proj set then use map->proj for bounding box. */
if (msOWSGetLayerExtent(map, lp, "FO", &ext) == MS_SUCCESS)
{
+ msInitProjection(&poWfs);
+ if (pszWfsSrs != NULL)
+ result = msLoadProjectionString(&(poWfs), (char *)pszWfsSrs);
+
if(lp->projection.numargs > 0)
{
msOWSPrintLatLonBoundingBox(stdout, " ", &(ext),
- &(lp->projection), OWS_WFS);
+ &(lp->projection), &(poWfs), OWS_WFS);
}
else
{
msOWSPrintLatLonBoundingBox(stdout, " ", &(ext),
- &(map->projection), OWS_WFS);
+ &(map->projection), &(poWfs), OWS_WFS);
}
+ msFreeProjection(&poWfs);
}
else
{
Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c 2008-06-20 02:42:51 UTC (rev 7717)
+++ trunk/mapserver/mapwms.c 2008-06-20 12:31:29 UTC (rev 7718)
@@ -1212,14 +1212,14 @@
if(lp->projection.numargs > 0)
{
msOWSPrintLatLonBoundingBox(stdout, " ", &(ext),
- &(lp->projection), OWS_WMS);
+ &(lp->projection), NULL, OWS_WMS);
msOWSPrintBoundingBox( stdout," ", &(ext), &(lp->projection),
&(lp->metadata), "MO" );
}
else
{
msOWSPrintLatLonBoundingBox(stdout, " ", &(ext),
- &(map->projection), OWS_WMS);
+ &(map->projection), NULL, OWS_WMS);
msOWSPrintBoundingBox(stdout," ", &(ext), &(map->projection),
&(map->web.metadata), "MO" );
}
@@ -1907,7 +1907,7 @@
OWS_WARN, " <SRS>%s</SRS>\n", "");
msOWSPrintLatLonBoundingBox(stdout, " ", &(map->extent),
- &(map->projection), OWS_WMS);
+ &(map->projection), NULL, OWS_WMS);
msOWSPrintBoundingBox( stdout, " ", &(map->extent), &(map->projection),
&(map->web.metadata), "MO" );
More information about the mapserver-commits
mailing list