[Mapserver-users] Find and ZoomTo shape file record

Steve McCrone ms57 at streamyx.com
Tue Sep 30 23:12:50 EDT 2003


On my previous application the user was able to find a record in the shape
file and the map would zoom into that record and colour it red. I did this
by having a java script function -

function findBuilding(inBuilding){
  var aForm = document.forms[0]
  aForm.building.value  = inBuilding;

  aForm.mode.value = "itemquery";
  aForm.qlayer.value = "building_query";
  aForm.mapext.value = "shapes";
  aForm.buffer.value = "0.005";
  aForm.submit()
}

and in my map file -

LAYER   # this layer just displays one building when it has been queried
  NAME "building_query"
  DATA Build
  TYPE  POLYGON
  STATUS OFF
  FILTERITEM Bldg_name
  FILTER "%building%"
  CLASS
    TEMPLATE "demo.html"        # Use to display map
    #COLOR 255 0 0
    #OUTLINECOLOR 255 0 0
  END # CLASS
END # LAYER

And it works fine.
========================================
Now, I am working with the sample - DHTML rubber-band zoom sample from
http://maps.dnr.state.mn.us/mapserver_demos/workshop

An I am trying to achive the same functionality. Note: I cannot "fix" the
extents of the map area I want to zoom because the spatial coordinates of
the shape fuile records are constantly changing. Thanks





More information about the mapserver-users mailing list