[mapserver-commits] r8559 - trunk/mapserver
svn at osgeo.org
svn at osgeo.org
Mon Feb 16 13:04:25 EST 2009
Author: assefa
Date: 2009-02-16 13:04:25 -0500 (Mon, 16 Feb 2009)
New Revision: 8559
Modified:
trunk/mapserver/mapfile.c
trunk/mapserver/mapwms.c
Log:
add wms 1.3.0 auto2 proj support #473
Modified: trunk/mapserver/mapfile.c
===================================================================
--- trunk/mapserver/mapfile.c 2009-02-16 13:25:30 UTC (rev 8558)
+++ trunk/mapserver/mapfile.c 2009-02-16 18:04:25 UTC (rev 8559)
@@ -875,20 +875,32 @@
/* WMS/WFS AUTO projection: "AUTO:proj_id,units_id,lon0,lat0" */
args = msStringSplit(p->args[0], ',', &numargs);
- if (numargs != 4 || strncasecmp(args[0], "AUTO:", 5) != 0)
+ if (numargs != 4 ||
+ (strncasecmp(args[0], "AUTO:", 5) != 0 &&
+ strncasecmp(args[0], "AUTO2:", 6) != 0))
{
msSetError(MS_PROJERR,
- "WMS/WFS AUTO PROJECTION must be in the format "
- "'AUTO:proj_id,units_id,lon0,lat0' (got '%s').\n",
+ "WMS/WFS AUTO/AUTO2 PROJECTION must be in the format "
+ "'AUTO:proj_id,units_id,lon0,lat0' or 'AUTO2:crs_id,factor,lon0,lat0'(got '%s').\n",
"_msProcessAutoProjection()", p->args[0]);
return -1;
}
- nProjId = atoi(args[0]+5);
+ if (strncasecmp(args[0], "AUTO:", 5)==0)
+ nProjId = atoi(args[0]+5);
+ else
+ nProjId = atoi(args[0]+6);
+
nUnitsId = atoi(args[1]);
dLon0 = atof(args[2]);
dLat0 = atof(args[3]);
+
+ /*There is no unit parameter for AUTO2. The 2nd parameter is
+ factor. Set the units to always be meter*/
+ if (strncasecmp(args[0], "AUTO2:", 6) == 0)
+ nUnitsId = 9001;
+
msFreeCharArray(args, numargs);
/* Handle EPSG Units. Only meters for now. */
@@ -998,9 +1010,11 @@
return 0;
}
- if (strncasecmp(p->args[0], "AUTO:", 5) == 0)
+ if (strncasecmp(p->args[0], "AUTO:", 5) == 0 ||
+ strncasecmp(p->args[0], "AUTO2:", 6) == 0)
{
/* WMS/WFS AUTO projection: "AUTO:proj_id,units_id,lon0,lat0" */
+ /*WMS 1.3.0: AUTO2:auto_crs_id,factor,lon0,lat0*/
return _msProcessAutoProjection(p);
}
msAcquireLock( TLOCK_PROJ );
@@ -1147,11 +1161,13 @@
p->args = msStringSplit(trimmed,'+', &p->numargs);
free( trimmed );
}
- else if (strncasecmp(value, "AUTO:", 5) == 0)
+ else if (strncasecmp(value, "AUTO:", 5) == 0 ||
+ strncasecmp(value, "AUTO2:", 6) == 0)
{
- /* WMS/WFS AUTO projection: "AUTO:proj_id,units_id,lon0,lat0" */
- /* Keep the projection defn into a single token for writeProjection() */
- /* to work fine. */
+ /* WMS/WFS AUTO projection: "AUTO:proj_id,units_id,lon0,lat0" */
+ /* WMS 1.3.0 projection: "AUTO2:auto_crs_id,factor,lon0,lat0"*/
+ /* Keep the projection defn into a single token for writeProjection() */
+ /* to work fine. */
p->args = (char**)malloc(sizeof(char*));
p->args[0] = strdup(value);
p->numargs = 1;
Modified: trunk/mapserver/mapwms.c
===================================================================
--- trunk/mapserver/mapwms.c 2009-02-16 13:25:30 UTC (rev 8558)
+++ trunk/mapserver/mapwms.c 2009-02-16 18:04:25 UTC (rev 8559)
@@ -711,6 +711,28 @@
}
msFreeProjection( &proj );
}
+ /*if the CRS is AUTO2:auto_crs_id,factor,lon0,lat0,
+ we need to grab the factor patameter and use it with the bbox*/
+ if (strlen(srsbuffer) > 1 && strncasecmp(srsbuffer, "AUTO2:", 6) == 0)
+ {
+ char **args;
+ int numargs;
+ double factor;
+ args = msStringSplit(srsbuffer, ',', &numargs);
+ if (numargs == 4)
+ {
+ factor = atof(args[1]);
+ if (factor > 0 && factor != 1.0)
+ {
+ rect.minx = rect.minx*factor;
+ rect.miny = rect.miny*factor;
+ rect.maxx = rect.maxx*factor;
+ rect.maxx = rect.maxy*factor;
+ }
+ }
+ msFreeCharArray(args, numargs);
+ }
+
map->extent.minx = rect.minx;
map->extent.miny = rect.miny;
map->extent.maxx = rect.maxx;
More information about the mapserver-commits
mailing list