[mapserver-users] GetFeatureInfo from Oracle Spatial

Kristian Thy thy at 42.dk
Sat Jun 7 18:49:19 EDT 2008


Hi list

I've made a small openlayers viewer that shows a data layer from a
materialized view in Oracle Spatial. When clicking on the map, I do a
simple GetFeatureInfo which works when I test it with a shapefile-based
layer, but when I move to the Oracle layer, I get an error message
saying that no features were found with MAXIMO_ID = 0 (something to that
effect, anyways). Unfortunately this is an internal GIS app, so I can't
demo it.

The relevant layer definition in my map file:
------------------------------------------------------------------------
  LAYER
    NAME 'TRIM-Q'
    TYPE POINT
    CONNECTIONTYPE oraclespatial
    CONNECTION "******@******"
    DATA "SHAPE FROM (SELECT MAXIMO_ID, ASSETTYPE, SHAPE FROM MAPSERVER_TRIMQ) USING UNIQUE MAXIMO_ID SRID 32632 VERSION 10g"
    TEMPLATE "trim.html"
    HEADER "trim_header.html"
    FOOTER "trim_footer.html"
    TOLERANCE 20
    DUMP true 

    METADATA
      "wms_title" "TRIM-Q"
      "wms_srs" "EPSG:32632"
      "wms_include_items" "ALL"
      "ows_include_items" "ALL"
      "gml_include_items" "ALL"
    END #metadata

    CLASS
      NAME 'vejskab' 
      EXPRESSION ('[ASSETTYPE]' = 'VEJSKAB')
      STYLE
        SYMBOL 'square'
        OFFSET -4 -2
      END #STYLE
      LABEL
        type truetype
        antialias true
        font arial_black
        size 8
        position ll
        color 0 0 0
        outlinecolor 255 255 255
        buffer 2
        partials false
      END #label
      TEXT ([MAXIMO_ID])
    END #class

    CLASS
      #NAME faerdselstavle
      EXPRESSION ('[ASSETTYPE]' = 'TAVLE')
      STYLE
        SYMBOL 'triangle'
        OFFSET -10 2
      END #STYLE
      LABEL
        FORCE true
        type truetype
        antialias true
        font arial_black
        size 8
        position lc
        color 0 0 0
        outlinecolor 255 255 255
        buffer 0
        partials false
      end #label
      TEXT ([MAXIMO_ID])
    END #class

    CLASS
      #NAME 'other values'
      STYLE
        SYMBOL 'circle'
        SIZE 2
        COLOR 100 0 0
      END #STYLE
      LABEL
        type truetype
        antialias true
        font arial_black
        size 8
        position uc
        color 0 0 0
        outlinecolor 255 255 255
        buffer 2
        partials false
      end #label
      TEXT ([MAXIMO_ID])
    END #class

    SIZEUNITS PIXELS
    STATUS ON
    UNITS meters
    MAXSCALE 60000
    LABELMAXSCALE 60000    
  END #layer
------------------------------------------------------------------------

The OpenLayers code I use for calling GetFeatureInfo:
------------------------------------------------------------------------
			map.events.register('click', map, function (e)
			{
				var url = trimq.getFullRequestString({
					REQUEST: 'GetFeatureInfo',
					EXCEPTIONS: 'application/vnd.ogc.se_xml',
					BBOX: trimq.map.getExtent().toBBOX(),
					X: e.xy.x,
					Y: e.xy.y,
					INFO_FORMAT: 'text/plain',
					QUERY_LAYERS: 'TRIM-Q',
					RADIUS: 5,
					WIDTH: trimq.map.size.w,
					HEIGHT: trimq.map.size.h});
				document.getElementById('map').style.cursor = 'wait';
				OpenLayers.loadURL(url, '', this, handleResponse);
				Event.stop(e);
			});

			function handleResponse(response)
			{
				document.getElementById('map').style.cursor = 'auto';
				alert(response.responseText);
			}
------------------------------------------------------------------------

As mentioned, this works if I query a shapefile-based layer, so I assume
the javascript is ok. Any ideas what my problem is?

\\kristian
-- 
... et nemo ex vobis interrogat me: »Quo vadis?«


More information about the mapserver-users mailing list