<div dir="ltr">Hello everybody,<br><br>BACKGROUND INFO<br>------------------------------<br>I compiled and installed Mapserver 7.4.2 on OS X 10.13.6 as a framework, 64-bit, using CMAKE. It works.<br>The dependencies I am using are the frameworks from KyngChaos (<a href="http://www.kyngchaos.com/">http://www.kyngchaos.com/</a>):<br>GDAL 2.4, PROJ 5.0, GEOS 3.7.x, Postgres 9.6, PostGIS 2.5, etc.<br><br>I used on and off Mapserver since version 5.x so, I know how it's supposed to work. After installation, when I run in terminal<br>"$ /Library/WebServer/CGI-Executables/mapserv -v"<br><br>I get:<br>MapServer version 7.4.2 OUTPUT=PNG OUTPUT=JPEG OUTPUT=KML SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=CAIRO SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=SOS_SERVER SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=JPEG INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE<br><br>ISSUE:<br>----------<br>I am trying to create simple files (*.map and *.html) in a directory named "msquery" where I can successfully implement the Search by Attribute, basically a prototype. For this, I created a shapefile, in EPSG:3857 (web mercator), with 3 shapes: a rectangle, a circle, and a triangle. The DBF file shows (wkt_geom is not in the DBF file):<br><br>OID (Integer),STYPE(string) -- WKT geometry in Shapefile<br>1,rectangle, -- wkt_geom: LineString (3194696 5605893, 3196116 5605893, 3196116 5604938, 3194696 5604938, 3194696 5605893)<br>2,circle, -- ...too many vertices to list here...<br>3,triangle -- wkt_geom: LineString (3197117 5604282, 3196225 5602525, 3198201 5602525, 3197117 5604282)<br><br>What I want is a very simple thing. In an html file displaying the map, have a form with a text input, where if I enter STYPE="rectangle" or STYPE="triangle" (qitem=STYPE&qstring=triangle), to take me to the same html page or another one, that would display a map image, displaying either the rectangle or the triangle (the queried item), zoomed at the shape's extent +5% buffer (whatever Mapserver's default is), with a highlighted color.<br><br>Here's my files:<br><br><span style="font-family:arial,sans-serif">1) index.html -- simple file initializing the map via a form:</span><span style="font-family:monospace"><br><!DOCTYPE html><br><html lang="en"><br><head><br>    <meta charset="utf-8" /><br>    <title>Index File - Initialize Mapserver App</title><br></head><br><body><br><p>Set default variables and initialze the Mapserver app and map.</p><br><hr><br><form method="get" name="initialize" action="/cgi-bin/mapserv"><br><input type="radio" name="map" value="/Library/Webserver/Documents/msquery/qry.map" checked> MAP = qry.map<br><br><input type="radio" name="layer" value="testdata" checked> LAYER = testdata<br><br><!-- apparently mode=BROWSE is set by default, so it's not needed here--><br><input type="submit" value="display map"><br></form><br></body><br></html></span><br><div><br></div><div>2) qry_browse.html</div><div><span style="font-family:monospace"><!-- Mapserver Template --><br><!DOCTYPE html><br><html lang="en"><br><head><br>     <meta charset="utf-8" /><br>      <title>Index File Attribute Query Demo</title><br></head><br><body><br><center><br><br><form method="GET" action="/cgi-bin/mapserv" name="mapserv"><br><table><br><tr><br>        <td><br>    <!-- map image --><br>              <input type="image" name="img" src="[img]" width="[mapwidth]" height="[mapheight]" border="1" alt="this is the map"><br>      <!-- // map image --><br>   </td><br>   <td valign="top"><br>             <font size="-1"><br>              <input type="radio" name="map" value="[map]" checked> MAP: &quot;[map]&quot; <br><br>           <input type="radio" name="layer" value="[layer]" checked> LAYER: &quot;[layer]&quot; <br><br>           &nbsp; IMGXY = [center] <br><br>                &nbsp; IMGEXT = [mapext] <br><br>               <hr><br>            Map Mode:<br><br>           <input type="radio" name="mode" value="browse" selected> browse<br><br>         ------------------------ <br><br>           <input type="radio" name="mode" value="itemquery"> itemquery<br><br>            QLAYER: "testdata"<br><br>                <input type="hidden" name="qlayer" value="testdata"><br>              QITEM: "STYPE"<br><br>            <input type="hidden" name="qitem" value="STYPE"><br>          QSTRING: <input type="text" name="qstring" value=""><br><br>            </font><br> </td><br></tr><br></table><br><hr><br><!-- these 2 are required for centering the map where clicked, while panning the image in BROWSE mode --><br><input type="hidden" name="imgxy" value="[center]"><br><input type="hidden" name="imgext" value="[mapext]"><br><br><input type="submit" value="refresh"><br></form><br><br></center><br></body><br></html></span></div><div><br></div><div>3) qry.map</div><div><br></div><div><span style="font-family:monospace">MAP<br><br>   IMAGETYPE PNG24<br>       NAME QUERYDEMO<br>        SIZE 1000 800<br> EXTENT  3192000 5601300 3202000 5608000 # in epsg:3857<br>        PROJECTION<br>            "init=epsg:3857"<br>    END<br>   UNITS METERS<br>  SHAPEPATH "data"<br>    IMAGECOLOR 255 255 255<br>        # TEMPLATEPATTERN may not be needed<br>   TRANSPARENT ON<br></span>   <span style="font-family:monospace"><br>  CONFIG "MS_ERRORFILE" "/Library/WebServer/Documents/msquery/ms_error_log.txt"<br>     DEBUG 5<br></span>  <span style="font-family:monospace"><br>  WEB<br>           MINSCALEDENOM 106<br>             MAXSCALEDENOM 54167.9728005186<br>                IMAGEPATH "/Library/WebServer/Documents/msquery/tmp/"<br>               IMAGEURL "/msquery/tmp/"<br>            LOG "/Library/WebServer/Documents/msquery/ms_error_log.txt"<br>         METADATA<br>                      # no need for WMS/WFS for this demo<br>           END<br>           TEMPLATE qry_browse.html<br>              VALIDATION<br>                            'qstring'  '.'<br>                               'STYPE' '.'<br>                           'OID' '.'<br>             END<br>   END # WEB<br></span>        <span style="font-family:monospace"><br>  # SYMBOL DEFINITIONS<br>  SYMBOL<br>                NAME 'circle'<br>         TYPE ELLIPSE<br>          POINTS 1 1 END<br>                FILLED TRUE<br>   END<br><br><br>       QUERYMAP<br>              COLOR 0 0 255<br>         STATUS ON<br>             STYLE HILITE<br>  END<br><br> LAYER # line layer begins here<br>                NAME         testdata<br>             DATA         "testdata.shp"<br>             STATUS       ON<br>            TYPE         LINE<br>         PROJECTION<br>                    "init=epsg:3857"<br>            END<br>           CLASS<br>                 TEMPLATE "qry_browse.html" # this seems to be ncecessary to make the layer/class queriable<br>                  NAME 'default'# Name to use in legends for this class. If not set class won’t show up in legend.<br>                    STYLE<br>                         SYMBOL     0<br>                                COLOR      255 0 0<br>                         SIZE       1<br>                       END<br>                   STATUS on<br>                     # TEMPLATE # Template file or URL to use in presenting query results to the user. See Templating for more info.<br>               END # end of CLASS<br>            #VALIDATION # As of MapServer 5.4.0, VALIDATION blocks are the preferred mechanism for specifying validation patterns for CGI param runtime substitutions. See Run-time Substitution.<br>         #END # end of VALIDATION<br>      END # end of LAYER<br><br>END # end of mapfile</span></div><div><br></div><div>At this point the error I'm getting is: <br></div><div><span style="font-family:monospace">msQueryByFilter(): Search returned no results. No matching record(s) found.</span></div><div><span style="font-family:monospace"><br></span></div><div><span style="font-family:arial,sans-serif">I don't know of the VALIDATION block is correct (syntax) and/or if it's placed where it should be.</span></div><div><span style="font-family:arial,sans-serif">I also don't know if the "qry_browse.html" html is is supposed to display the query results, or the query form should redirect the display to a different html template.</span></div><div><span style="font-family:arial,sans-serif">I also don't know if the search map file should be different than qry.map.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">I've been banging my head against the walls for the past 2.5 days and it seems to go nowhere, for such a simple feature. The documentation did not help me very much, nor did the Mapserver demo files, as the examples are old, they do not contain text/attribute based queries, plus the query validation has changed several times across version since the demo was built.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">I am attaching a zipped copy of my prototype folder for ease of evaluation.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">Thanks in advance for your help.</span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><span style="font-family:arial,sans-serif">PS: this should eventually make it in the demo, as it is probably one of the most necessary features users look for.<br></span></div><div><span style="font-family:arial,sans-serif"><br></span></div><div><br></div></div>