[Mapserver-users] itemquery doesn't find records

Steve Lime steve.lime at dnr.state.mn.us
Mon Jan 12 16:26:49 EST 2004


The problem is in your qstring. Remember that qstring is a valid
MapServer filter expression. I say filter because depending on the
backend data source it may not be limited to a MapServer class
expression. On to the point.

[ID_EMPLAZ] = '02-02290'

is not valid for 2 reasons. First, the [ID_EMPLAZ] is not quoted, and
second the whole thing needs to be in parenthesis.

('[ID_EMPLAZ]' = '02-02290')

Should work. It's not, however, the best way to do it. Since your
simply testing equality of a single attribute just set qitem to
ID_EMPLAZ and qstring to 02-02290 and it should work too, but faster.

Steve

>>> "Nikolai Vladychevski" <niko at isl.net.mx> 1/11/2004 2:43:25 PM >>>
Hello, 

I am trying about 4 hours to make an itemquery query without success.
I
have tryed many qstring values but I still get:
"msQueryByAttributes(): Search returned no results. No matching
record(s) 
found." error. 

I don't know what to do, can somebody give any tips how to debug this ?


This is my MapServer version:
MapServer version 4.0.1 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP
SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER INPUT=TIFF
INPUT=EPPL7 INPUT=JPEG INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE 

This is the line in perl that I output to the browser:
print 
$q->header(-location=>"http://$ENV{HTTP_HOST}/cgi-bin/mapserv?layer=enlaces&

layer=emplazamientos&map=".uri_escape("/var/www/html/map/my.map")."&scale=20

0&program=".uri_escape("/cgi-bin/mapserv")."&savequery=true&zoomdir=0&mode=i

temquery&qitem=".uri_escape("ID_EMPLAZ")."&qstring=".uri_escape("[ID_EMPLAZ]

= 
'02-02290'")."&qlayer=emplazamientos&mapext=-117.124014+14.530688+-86.709056

+32.718120&codempl=02-02290&map_web_imagepath=".uri_escape("/var/www/html/tm

p/")."&map_web_imageurl=".uri_escape("/tmp/")."&zoomsize=2"); 

This is my map gobal extent: 

EXTENT -117.124014 14.530688 -86.709056 32.718120 

This is the layer definition 

 LAYER
       NAME emplazamientos
       DATA emplazamientos
       DEBUG ON
       STATUS OFF
       TYPE POINT
       TOLERANCEUNITS pixels
       TOLERANCE 5
       FILTERITEM 'ID_EMPLAZ'
       FILTER '%codempl%'
       CLASS
           NAME 'emplazamientos'
           COLOR 0 0 255
           SYMBOL 'circle'
           SIZE 5
           TEMPLATE emplazamiento.html
       END
  END 

The record exists: 

[root at localhost map]# ogrinfo -al data/emplazamientos.shx |grep -A3 -B4

02-02290
OGRFeature(emplazamientos):9
 NOMBRE (String) = Esperanza
 LAT (Real) =    -115.4952
 LON (Real) =      32.6488
 ID_EMPLAZ (String) = 02-02290
 ID_CLASE (Integer) = 2290
 POINT (-115.49517100 32.64879900)

The POINT is inside the extent:
 -117.124014 (-115.49517100) -86.709056
  14.530688 (  32.64879900)  32.718120 

The template file exists: 

[root at localhost map]# cat emplazamiento.html
Emplazamiento: [ID_EMPLAZAM]:<br>
Nombre: [NOMBRE]<br>
Latitud: [LAT]<br>
Longitud: [LON]<br>
ID_Clase: [ID_CLASE]<br>
[root at localhost map]# 


Full mapserver file: 


MAP
 NAME TRANSMISION
 STATUS ON
 IMAGETYPE PNG
 EXTENT -117.124014 14.530688 -86.709056 32.718120
 SIZE 800 600
 SHAPEPATH "data"
 IMAGECOLOR 255 255 255
 FONTSET fonts/fonts.list
 WEB
   HEADER map_header.html
   TEMPLATE map.html
   FOOTER map_footer.html
   MINSCALE 0.001
   MAXSCALE 200
   IMAGEPATH "/var/www/html/tmp"
   IMAGEURL "/tmp"
   METADATA
	WMS_TITLE "MapServer"
	WMS_ABSTRACT "Despliege de Enlaces y Emplazamientos"
	WMS_ACCESSCONSTRAINTS none
   END 

 END 

 SCALEBAR
   IMAGECOLOR 255 255 255
   LABEL
     COLOR 0 0 0
     SIZE TINY
   END
   STYLE 1
   SIZE 100 2
   COLOR 0 0 0
   UNITS KILOMETERS
   INTERVALS 2
   TRANSPARENT FALSE
   STATUS ON
 END 

 QUERYMAP
   SIZE 800 600
   STATUS ON
   STYLE HILITE
   COLOR 255 0 0
 END

 REFERENCE
	IMAGE "mxmap.gif"
       EXTENT -117.124014 14.530688 -86.709056 32.718120
	SIZE 250 155
	STATUS ON
	MAXBOXSIZE 246
	COLOR -1 -1 -1
	OUTLINECOLOR 255 0 0
 END 

 PROJECTION
	"proj=laea"
	"ellps=clrk66"
	"lat_0=23"
	"lon_0=-110"
 END 

 LAYER
	NAME region
	DATA region
	STATUS DEFAULT
	TYPE POLYGON 

	CLASS
	    COLOR 255 255 255
	    OUTLINECOLOR 32 32 32
	END
  END 

 LAYER
	NAME enlaces
	DATA enlaces
	STATUS ON
	TYPE LINE
       TOLERANCEUNITS pixels
	TOLERANCE 3
	CLASSITEM "id_enlace"
	LABELITEM "id_enlace"
	SYMBOLSCALE 0.001
	LABELMAXSCALE 0.1
	CLASS
	    COLOR 0 255 0
	    OUTLINECOLOR 0 0 0
	    LABEL
		TYPE TRUETYPE
		ANTIALIAS TRUE
		FONT arial
		COLOR 0 0 0
		BACKGROUNDCOLOR 255 255 230
		SIZE 8
		MINSIZE 8
		MAXSIZE 12
		ANGLE AUTO
		POSITION CC
		MINFEATURESIZE AUTO
		BUFFER 2
	    END
	TEMPLATE enlaces.html
	END
 END 

 LAYER
	NAME emplazamientos
	DATA emplazamientos
	DEBUG ON
	STATUS OFF
	TYPE POINT
       TOLERANCEUNITS pixels
	TOLERANCE 5
	FILTERITEM 'ID_EMPLAZ'
	FILTER '%codempl%'
	CLASS
	    NAME 'emplazamientos'
	    COLOR 0 0 255
	    SYMBOL 'circle'
	    SIZE 5
	    TEMPLATE emplazamiento.html
	END
  END 

  SYMBOL
 	NAME 'circle'
	TYPE ELLIPSE
	POINTS 1 1 END
	FILLED TRUE
  END
END 

_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu 
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users



More information about the mapserver-users mailing list