[mapserver-commits] r10079 - in trunk/msautotest: gdal gdal/data gdal/expected mspython

svn at osgeo.org svn at osgeo.org
Thu Apr 8 13:42:55 EDT 2010


Author: warmerdam
Date: 2010-04-08 13:42:53 -0400 (Thu, 08 Apr 2010)
New Revision: 10079

Added:
   trunk/msautotest/gdal/data/tile_index.mid
   trunk/msautotest/gdal/data/tile_index.mif
   trunk/msautotest/gdal/expected/tileindex_mi.png
   trunk/msautotest/gdal/tileindex_mi.map
Modified:
   trunk/msautotest/mspython/rqtest.py
Log:
add testing of raster query on non-shapefile tileindexes (#2796)

Added: trunk/msautotest/gdal/data/tile_index.mid
===================================================================
--- trunk/msautotest/gdal/data/tile_index.mid	                        (rev 0)
+++ trunk/msautotest/gdal/data/tile_index.mid	2010-04-08 17:42:53 UTC (rev 10079)
@@ -0,0 +1,4 @@
+"tile11.vrt"
+"tile12.vrt"
+"tile21.vrt"
+"tile22.vrt"

Added: trunk/msautotest/gdal/data/tile_index.mif
===================================================================
--- trunk/msautotest/gdal/data/tile_index.mif	                        (rev 0)
+++ trunk/msautotest/gdal/data/tile_index.mif	2010-04-08 17:42:53 UTC (rev 10079)
@@ -0,0 +1,43 @@
+Version 300
+Charset "Neutral"
+Delimiter ","
+Columns 1
+  location Char(254)
+Data
+
+Region 1
+  5
+0 60
+40 60
+40 30
+0 30
+0 60
+    Pen (1,2,0)
+    Brush (1,0,16777215)
+Region 1
+  5
+0 30
+40 30
+40 0
+0 0
+0 30
+    Pen (1,2,0)
+    Brush (1,0,16777215)
+Region 1
+  5
+40 60
+80 60
+80 30
+40 30
+40 60
+    Pen (1,2,0)
+    Brush (1,0,16777215)
+Region 1
+  5
+40 30
+80 30
+80 0
+40 0
+40 30
+    Pen (1,2,0)
+    Brush (1,0,16777215)

Added: trunk/msautotest/gdal/expected/tileindex_mi.png
===================================================================
(Binary files differ)


Property changes on: trunk/msautotest/gdal/expected/tileindex_mi.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: trunk/msautotest/gdal/tileindex_mi.map
===================================================================
--- trunk/msautotest/gdal/tileindex_mi.map	                        (rev 0)
+++ trunk/msautotest/gdal/tileindex_mi.map	2010-04-08 17:42:53 UTC (rev 10079)
@@ -0,0 +1,49 @@
+#
+# REQUIRES: SUPPORTS=PROJ
+#
+# This map is also used by ../mspython/rqtest.py
+#
+MAP
+
+NAME TEST
+STATUS ON
+SIZE 400 300
+EXTENT 0.5 0.5 79.5 59.5
+IMAGECOLOR 255 255 0
+SHAPEPATH "data"
+
+PROJECTION
+  "+proj=latlong +datum=WGS84" 
+END
+
+IMAGETYPE png8_t
+
+OUTPUTFORMAT
+  NAME png8_t
+  DRIVER "GD/PNG"
+  EXTENSION "png"
+  MIMETYPE "image/png"
+  IMAGEMODE PC256
+  TRANSPARENT OFF
+END
+
+LAYER
+  NAME grey
+  TYPE raster
+  STATUS default
+  DUMP TRUE
+  TEMPLATE "fake.html"
+  TILEINDEX tindex
+  TILEITEM "location"
+  PROJECTION
+    "+proj=latlong +datum=WGS84" 
+  END
+END
+
+LAYER 
+  NAME tindex
+  TYPE polygon
+  DATA "tile_index.mif"
+END
+
+END # of map file

Modified: trunk/msautotest/mspython/rqtest.py
===================================================================
--- trunk/msautotest/mspython/rqtest.py	2010-04-08 12:49:31 UTC (rev 10078)
+++ trunk/msautotest/mspython/rqtest.py	2010-04-08 17:42:53 UTC (rev 10079)
@@ -27,35 +27,6 @@
 #  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 #  DEALINGS IN THE SOFTWARE.
 ###############################################################################
-# 
-# $Log$
-# Revision 1.10  2006/02/13 17:19:32  frank
-# Added msCleanup call.
-#
-# Revision 1.9  2004/11/02 02:09:25  frank
-# adjust for renaming of values to value_list
-#
-# Revision 1.8  2004/11/02 01:32:45  frank
-# Added extra tests for projection cases.
-#
-# Revision 1.7  2004/11/01 21:33:42  frank
-# Added reference to raster query classification bug (1021) in rqtest_13.
-#
-# Revision 1.6  2004/10/22 15:42:46  frank
-# updated to latest API
-#
-# Revision 1.5  2004/07/27 21:51:42  frank
-# reverted to *not* use next generation names, no longer promoted
-#
-# Revision 1.4  2004/05/28 20:28:54  frank
-# Change rqtest_6 to operate against the map to ensure that works.
-#
-# Revision 1.3  2004/05/27 17:34:46  frank
-# Updated to work with new or old APIs and names.
-#
-# Revision 1.2  2004/05/13 03:03:28  frank
-# added header
-#
 
 import sys
 import math
@@ -669,6 +640,70 @@
     return 'success'
     
 ###############################################################################
+# Make a similar test with the tileindex file in mapinfo format (#2796)
+
+def rqtest_16():
+
+    pmstestlib.map = mapscript.mapObj('../gdal/tileindex_mi.map')
+    pmstestlib.layer = pmstestlib.map.getLayer(0)
+
+    pmstestlib.map.setProjection("+proj=utm +zone=30 +datum=WGS84")
+
+    pnt = mapscript.pointObj()
+    pnt.x =  889690
+    pnt.y =   55369
+    
+    pmstestlib.layer.queryByPoint( pmstestlib.map, pnt, mapscript.MS_MULTIPLE,
+                                   200000.0 )
+
+    return 'success'
+
+###############################################################################
+# Check result count, and that the results are within the expected distance.
+# This also implicitly verifies the results were reprojected back to UTM
+# coordinates from the lat long system of the layer.
+
+def rqtest_17():
+    
+    layer = pmstestlib.layer
+    
+    pnt = mapscript.pointObj()
+    pnt.x =  889690
+    pnt.y =   55369
+    
+    #########################################################################
+    # Check result count.
+    layer.open()
+    count = 0
+    for i in range(1000):
+        result = layer.getResult( i )
+        if result is None:
+            break
+
+        count = count + 1
+
+        s = layer.getFeature( result.shapeindex, result.tileindex )
+        x = float(pmstestlib.get_item_value( layer, s, 'x' ))
+        y = float(pmstestlib.get_item_value( layer, s, 'y' ))
+        dist_sq = (x-pnt.x) * (x-pnt.x) + (y-pnt.y) * (y-pnt.y)
+        dist = math.pow(dist_sq,0.5)
+        if dist > 200000.0:
+            pmstestlib.post_reason(
+                'Got point %f from target, but tolerance was 200000.0.' % dst )
+            return 'fail'
+                
+    
+    if count != 4:
+        pmstestlib.post_reason( 'got %d results instead of expected %d.' \
+                             % (count, 10) )
+        return 'fail'
+
+    layer.close() 
+    layer.close() # discard resultset.
+
+    return 'success'
+    
+###############################################################################
 # Cleanup.
 
 def rqtest_cleanup():
@@ -694,6 +729,8 @@
     rqtest_13,
     rqtest_14,
     rqtest_15,
+    rqtest_16,
+    rqtest_17,
     rqtest_cleanup ]
 
 if __name__ == '__main__':



More information about the mapserver-commits mailing list