[mapserver-commits] r7739 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jun 24 17:47:34 EDT 2008


Author: Assefa
Date: 2008-06-24 17:47:34 -0400 (Tue, 24 Jun 2008)
New Revision: 7739

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapogcfilter.c
Log:
Respect units for the DWhitin parameter (#2297)

Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-06-24 15:21:52 UTC (rev 7738)
+++ trunk/mapserver/HISTORY.TXT	2008-06-24 21:47:34 UTC (rev 7739)
@@ -12,6 +12,8 @@
 Current Version (SVN trunk):
 ----------------------------
 
+- WFS: Respect units for the DWhitin parameter (#2297)
+
 - WFS: correct OGC Contains filter  (#2306)
 
 - WMS: set srsName correctly for GetFeatureInfo (#2502)

Modified: trunk/mapserver/mapogcfilter.c
===================================================================
--- trunk/mapserver/mapogcfilter.c	2008-06-24 15:21:52 UTC (rev 7738)
+++ trunk/mapserver/mapogcfilter.c	2008-06-24 21:47:34 UTC (rev 7739)
@@ -329,6 +329,9 @@
 #ifdef USE_GEOS
                 msGEOSSetup();
 #endif
+                if (nUnit >=0 && nUnit != map->units)
+                  dfDistance *= msInchesPerUnit(nUnit,0)/msInchesPerUnit(map->units,0);
+
                 psTmpShape = msGEOSBuffer(psQueryShape, dfDistance);
                 if (psTmpShape)
                 {
@@ -371,6 +374,12 @@
 #ifdef USE_GEOS
                 msGEOSSetup();   
 #endif         
+/* -------------------------------------------------------------------- */
+/*      if units is set, covert value from unit to map unit.            */
+/* -------------------------------------------------------------------- */
+                if (nUnit >=0 && nUnit != map->units)
+                  dfDistance *= msInchesPerUnit(nUnit,0)/msInchesPerUnit(map->units,0);
+
                 psTmpShape = msGEOSBuffer(psQueryShape, dfDistance);
                 if (psTmpShape)
                 {
@@ -2454,15 +2463,23 @@
                             else
                               szUnit = tokens[1];
 
-                            if (strcasecmp(szUnit,"m") == 0)
+                            if (strcasecmp(szUnit,"m") == 0 ||
+                                strcasecmp(szUnit,"meters") == 0 )
                               *pnUnit = MS_METERS;
-                            else if (strcasecmp(szUnit,"km") == 0)
+                            else if (strcasecmp(szUnit,"km") == 0 || 
+                                     strcasecmp(szUnit,"kilometers") == 0)
                               *pnUnit = MS_KILOMETERS;
-                            else if (strcasecmp(szUnit,"mi") == 0)
+                            else if (strcasecmp(szUnit,"mi") == 0 || 
+                                     strcasecmp(szUnit,"miles") == 0)
                               *pnUnit = MS_MILES;
-                           else if (strcasecmp(szUnit,"in") == 0)
+                            else if (strcasecmp(szUnit,"in") == 0 ||
+                                    strcasecmp(szUnit,"inches") == 0)
                               *pnUnit = MS_INCHES;
-                           else if (strcasecmp(szUnit,"deg") == 0)
+                           else if (strcasecmp(szUnit,"ft") == 0 ||
+                                    strcasecmp(szUnit,"feet") == 0)
+                             *pnUnit = MS_FEET;
+                           else if (strcasecmp(szUnit,"deg") == 0 ||
+                                    strcasecmp(szUnit,"dd") == 0)
                               *pnUnit = MS_DD;
                              else if (strcasecmp(szUnit,"px") == 0)
                               *pnUnit = MS_PIXELS;



More information about the mapserver-commits mailing list