[OpenLayers-Users] Get Feature Info in pop up working example

Robert Sanson SansonR at asurequality.com
Mon Mar 22 15:45:35 EDT 2010


Hi
 
GetFeatureInfo requests against Mapserver will not be much different than against ArcGIS WMS. Here is an example:
 
http://mapsvr/cgi-bin/mapserv.exe?map=mylocation&service=wms&version=1.1.1&request=GetFeatureInfo&LAYERS=synlait&QUERY_LAYERS=synlait&INFO_FORMAT=text/plain&SRS=EPSG:2193&BBOX=1492834.61,5131445.29,1493034.61,5131645.29&WIDTH=100&HEIGHT=100&x=50&y=50 

For a single point, just play around with the size of the BBOX, WIDTH, HEIGHT,x & y parameters - make as small or large as you need to ensure you get a single point. You can also specify a TOLERANCE in your mapfile:
 
LAYER
  NAME "synlait"
  GROUP "FMS"
  DATA ../data/nztm/synlait
  SIZEUNITS PIXELS
  STATUS ON
  DUMP TRUE
  # query templates for HTML-based queries
  # responds to OGC:WMS request=GetFeatureInfo......&info_format=text/html
  HEADER   ../templates/synlait_query_header.html
  TEMPLATE ../templates/synlait_query_body.html
  
  # fuzziness for querying
  TOLERANCE 5000
  TOLERANCEUNITS METERS
  TYPE POINT
  UNITS METERS
  # scale range
  MAXSCALE 250000
  MINSCALE 750
  LABELMAXSCALE 100000
  LABELMINSCALE 1
  LABELCACHE on
  LABELITEM 'reference_code'
  CLASS
    STYLE
      COLOR 138 43 226
      OUTLINECOLOR 0 0 0
      SIZE 13
      SYMBOL "triangle"
    END
    LABEL
      TYPE truetype
      FONT "arial"
      SIZE 10
      POSITION ur
      OUTLINECOLOR 235 235 235 #--Halo
      COLOR 0 0 0 
      BUFFER 2
    END #LABEL
  END #CLASS
    
  METADATA
    "wms_group_title" "FMS"
    "wms_name"    "synlait" 
    "wms_title"    "synlait"
    "wms_abstract"    "These are Synlait farms in NZTM"
    "wms_keywordlist"    "AgriBase"
    #"wms_server_version"    "1.1.1"
    "wms_srs"   "EPSG:2193"
    "wms_extent" "1114412.940 4793178.168 2089186.204 6190213.601"
    "wms_dataurl_format" "text/HTML"
    "gml_include_items"     "all"
    "gml_exclude_items"     ""
    "ows_include_items"     "all"
    "ows_exclude_items"     ""  
    "wms_exceptions_format" "application/vnd.ogc.se_xml"
  END
 END #synlait
 
Note: The DATA directive contains the path and name of the Shape file.
The HEADER and TEMPLATE directives reference a couple of html files that format the response to the GetFeatureInfo request when you request &info_format=text/html. If you are just requesting text/plain then you will get all of the attributes.
 
regards,
 
Robert

>>> sunny74 <sb.ray at hotmail.com> 22/03/2010 6:28 p.m. >>>


Hi Robert,

Thanks for your reply.

There are a few doubts about the code:

1) If you taken a single lonlat and then made a bounding box(BBOX) by doing
+- 10.
But what if I want to get the feature info of just one point.What will be
the url in that case?

2) The url is "var regc =
"http://ws-esrimt/arcgis/services/mapservice_asurequality_prod/MapServer/WMSServer?service=WMS&version=1.1.1&request=GetFeatureInfo&QUERY_LAYERS=2&INFO_FORMAT=text/plain&SRS=EPSG:2193&BBOX="
+ bbox1 + "," + bbox2 + "," + bbox3 + "," + bbox4 +
"&WIDTH=20&HEIGHT=20&X=10&Y=10";"

  It seems from the url that you r using ARCGIS with Mapserver. But if I am 
using
only mapserver with openlayers then what is the url?

3) HOw do I make a layers queryable in the map file? What r the extra things
I need to specify?

Pls reply soon.
-- 
View this message in context: http://n2.nabble.com/Get-Feature-Info-in-pop-up-working-example-tp4773944p4776299.html 
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org 
http://openlayers.org/mailman/listinfo/users 

------------------------------------------------------------------
The contents of this email are confidential to AsureQuality. If you have received this communication in error please notify the sender immediately and delete the message and any attachments. The opinions expressed in this email are not necessarily those of AsureQuality. This message has been scanned for known viruses before delivery. AsureQuality supports the Unsolicited Electronic Messages Act 2007. If you do not wish to receive similar communications in future, please notify the sender of this message.
------------------------------------------------------------------


This message has been scanned for malware by SurfControl plc. www.surfcontrol.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100323/d14045f3/attachment.html


More information about the Users mailing list