simple query on shapefile

Brant Anderson brant at MUDLABS.COM
Tue Aug 24 20:20:51 EDT 2004


Greetings Dylan,

WEB
  TEMPLATE  'map.html' # This is what I consider the "GLOBAL" browse mode template... to do a query, you need a template assigned to that layer.
  IMAGEPATH '/home/dylan/public_html/mapserver/ca_county/temp/'
  IMAGEURL  '/~dylan/mapserver/ca_county/temp/'
END


Here is your current layer definition:
# Start of LAYER DEFINITIONS ---------------------------------------------
LAYER # ca county polygon layer begins here
  NAME ca_cnty
  TYPE POLYGON
  CONNECTIONTYPE OGR
  CONNECTION "ca_cnty.shp"
  #DATA "SELECT * from poly"
  STATUS DEFAULT
  CLASS
    COLOR 50 100 220
    OUTLINECOLOR 32 32 32
  END
END # ca county polygon layer ends here
# End of LAYER DEFINITIONS -------------------------------


Here is a modified version of your layer:
# Start of LAYER DEFINITIONS ---------------------------------------------
LAYER # ca county polygon layer begins here
  NAME ca_cnty
  TYPE POLYGON
  CONNECTIONTYPE OGR
  CONNECTION "ca_cnty.shp"
  #DATA "SELECT * from poly"
  STATUS DEFAULT
  HEADER 'templates/ca_cnty_header.html' # Appears once as the header
  FOOTER 'templates/ca_cnty_footer.html' # Appears once as the footer
  CLASS
    COLOR 50 100 220
    OUTLINECOLOR 32 32 32
    TEMPLATE 'templates/ca_cnty.html # Loops one instance for each record. This is the template file that will be read for querying on this layer... If you query on multiple layers, you may want to add a HEADER and FOOTER tag to the WEB section.
  END
END # ca county polygon layer ends here
# End of LAYER DEFINITIONS -------------------------------

Here are a couple of links that might be helpful:
Mapfile Reference: http://mapserver.gis.umn.edu/doc42/mapfile-reference.html
Template Reference:
http://mapserver.gis.umn.edu/doc42/template-reference.html

A good way to get a grasp on this is through experimentation. Look at
the generated HTML code for patterns as a guide to help troubleshoot any
problems.

Hope this helps!
Good Luck!

Brant Anderson



Dylan Beaudette wrote:

> greetings,
>
> i am trying to query a simple map of california counties here:
> http://169.237.34.168/~dylan/mapserver/ca_county/map.html
>
> however, when the mode is set to nquery, a click on the map results in
> the following error:
> msQueryByPoint(): Search returned no results. No matching record(s)
> found.
>
> i have tried looking over some of the example mapserver  pages, but
> cannot figure out how the query mechanism really works...
>
> any points on how to get a working query system setup?
>
> here is the source for my .map file:
>
> http://169.237.34.168/~dylan/mapserver/ca_county/ca_county.map
>
> any ideas?
>
> thanks in advance!
>
> Dylan Beaudette
>



More information about the mapserver-users mailing list