[mapserver-users] Shapefile,itemnquery and HTML image map generation problem

Steve Lime Steve.Lime at state.mn.us
Tue Dec 8 06:26:06 PST 2009


Seems like an extent problem to me - the way the results are clustered in the
center of the image. MapServer does apply a spatial pre-filter for attribute
queries. However, the searchmap=true should compute a proper extent based
on your image properties (extent, size) before doing the query.

John, what are the changes you could zip up your data and mapfile for me?

Steve

>>> W.John Guineau <guineau at earthlink.net> 12/08/09 7:05 AM >>>
Ok, try this:

 



 

-----Original Message-----
From: Steve Lime [mailto:Steve.Lime at state.mn.us] 
Sent: Monday, December 07, 2009 7:57 PM
To: W.John Guineau; mapserver-users at lists.osgeo.org; 'Steve Lime'
Subject: RE: [mapserver-users] Shapefile,itemnquery and HTML image map
generation problem

 

Do the ones not selected fall at the end of your qstring? I'm wondering if
something is getting truncated. I'd think

you'd get a parsing error in that case, but perhaps not. Can you label the
polygons with the value for MLRARSYM?

 

Steve

 

>>> On 12/7/2009 at 6:19 PM, in message
<01dc01ca779c$2c19eae0$844dc0a0$@net>,

W.John Guineau <guineau at earthlink.net> wrote:

> Hi Steve,

> 

>  

> 

> OK, I added the QUERYMAP section and changed the URL:

> 

>  

> 

> http://localhost/cgi-bin/mapserv?map=/NWPL_CRREL/MLRA/mlra.map 

>
<http://localhost/cgi-bin/mapserv?map=/NWPL_CRREL/MLRA/mlra.map&qlayer=coe_m


>
&mode=itemnquerymap&searchmap=true&layer=states&mapext=-91+34+-89+49&mapsize

>
=600+400&qitem=MLRARSYM&qstring=(%22%5bMLRARSYM%5d%22%20in%20%22102A,102B,10

>
2C,103,104,105,106,107A,107B,108A,108B,108C,108D,109,110,111A,111B,111C,111D

> ,111E,112,113,114A,114B,115A,115B,115C%22)>

>
&qlayer=coe_m&mode=itemnquerymap&searchmap=true&layer=states&mapext=-91+34+-

>
89+49&mapsize=600+400&qitem=MLRARSYM&qstring=("[MLRARSYM]"%20in%20"102A,102B

>
,102C,103,104,105,106,107A,107B,108A,108B,108C,108D,109,110,111A,111B,111C,1

> 11D,111E,112,113,114A,114B,115A,115B,115C")

> 

>  

> 

>  

> 

> Now I get the map with some of the items highlighted in yellow, and the
rest

> green:

> 

>  

> 

> 

> 

>  

> 

> -----Original Message-----

> From: Steve Lime [mailto:Steve.Lime at state.mn.us] 

> Sent: Monday, December 07, 2009 7:04 PM

> To: W.John Guineau; mapserver-users at lists.osgeo.org; 'Steve Lime'

> Subject: RE: [mapserver-users] Shapefile,itemnquery and HTML image map

> generation problem

> 

>  

> 

> Just add a querymap object to your mapfile, like so:

> 

>  

> 

> QUERYMAP

> 

>   STATUS ON

> 

> END

> 

>  

> 

> Then change your URL to use the mode itemnquerymap and that should return

> just an image with the

> 

> selected features highlighted in yellow.

> 

>  

> 

> Steve

> 

>  

> 

>>>> On 12/7/2009 at 5:56 PM, in message

> <01ce01ca7798$dd4b89d0$97e29d70$@net>,

> 

> W.John Guineau <guineau at earthlink.net> wrote:

> 

>> I'm new to mapserver, how do I quickly generate a querymap?

> 

>> 

> 

>> I'm using mapserver 5.4.2 from the latest MS4W on Windows 7 x64. I've
also

> 

>> tried 5.2.1 that I compiled myself.

> 

>> 

> 

>> john

> 

>> 

> 

>> 

> 

>> -----Original Message-----

> 

>> From: Steve Lime [mailto:Steve.Lime at state.mn.us] 

> 

>> Sent: Monday, December 07, 2009 6:40 PM

> 

>> To: 'W.John Guineau'; mapserver-users at lists.osgeo.org 

> 

>> Subject: RE: [mapserver-users] Shapefile,itemnquery and HTML image map

> 

>> generation problem

> 

>> 

> 

>> GDAL's not in play here at all. If you generate a query map instead of an

> 

>> html image map does

> 

>> the output map look ok? What version are you using?

> 

>> 

> 

>> Steve

> 

>> 

> 

>>>>> On 12/4/2009 at 8:11 AM, in message

> 

>> <04e001ca74eb$bc473400$34d59c00$@net>,

> 

>> W.John Guineau <guineau at earthlink.net> wrote:

> 

>>> How would I go about debugging this? 

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> I think this is GDAL and its query of shapefiles, right?

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> The bottom line is that MapServer finds all the items when it is

> rendering

> 

>>> the map by layer/class EXPRESSION, but the qstring in a URL using the

> 

>> exact

> 

>>> same EXPRESSION string misses some of the items.

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> I can also use ogrinfo from MAP4W to execute an SQL query directly on
the

> 

>>> shapefile and the items in questions are certainly there.

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> In the image below, the green areas are result of the mapfile layer
class

> 

>>> EXPRESSION - all are correctly rendered. However, several of them do not

> 

>> get

> 

>>> generated (HTML imagemap <area> tags not generated) when using a URL and

> 

>>> itemnquery/qstring with the identical EXPRESSION.

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> How do I enable debug (enabling mapfile DEBUG does not seem to give any

> 

>>> useful info as to why GDAL is skipping certain items) Am I better off

> 

>> using

> 

>>> MAP4W or similar to get debug/trace info for shapefile queries?

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> john

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> 

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> From: mapserver-users-bounces at lists.osgeo.org 

> 

>>> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of W.John

> 

>> Guineau

> 

>>> Sent: Thursday, December 03, 2009 3:11 PM

> 

>>> To: mapserver-users at lists.osgeo.org 

> 

>>> Subject: [mapserver-users] Shapefile, itemnquery and HTML image map

> 

>>> generation problem

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> I have a basic vector shapefile that I am trying to generate HTML

> 

>> clickable

> 

>>> maps from. It seems to work well for the most part, however there is a

> 

>>> problem where some items from the shapefile do not get processed from
the

> 

>>> qstring in the browser, but they are processed fine in the mapfile layer

> 

>> (to

> 

>>> color them differently).

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> So the map that renders shows all the items colored properly as the
layer

> 

>>> class defines. Using the exact same list of items in the HTTP query

> string

> 

>>> causes several items to be ignored (the HTML image map area is not

> 

>>> generated).

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> 

> 

>> 

>
http://localhost/cgi-bin/mapserv?map=/NWPL_CRREL/MLRA/mlra.map&qlayer=coe_m&


> 

> 

>> 

> 

>>> 

> 

>> 

>
mode=itemnquery&searchmap=true&layer=states&mapext=-91+34+-89+49&mapsize=600

> 

>>> 

> 

>> 

>
+400&qitem=MLRARSYM&qstring=("[MLRARSYM]"%20in%20"102A,102B,102C,103,104,105

> 

>>> 

> 

>> 

>
,106,107A,107B,108A,108B,108C,108D,109,110,111A,111B,111C,111D,111E,112,113,

> 

>>> 114A,114B,115A,115B,115C")

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> Below is the layer section from the mapfile. I can post whatever else is

> 

>>> helpful. 

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> Thanks for any help on this.

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> john

> 

>>> 

> 

>>>  

> 

>>> 

> 

>>> LAYER 

> 

>>> 

> 

>>>                 NAME map_m

> 

>>> 

> 

>>>                 DATA "map_shape"

> 

>>> 

> 

>>>                 TEMPLATE "bodytemplate.html"

> 

>>> 

> 

>>>                 HEADER "imapheader.html"

> 

>>> 

> 

>>>                 FOOTER "imapfooter.html"

> 

>>> 

> 

>>>                 PROJECTION

> 

>>> 

> 

>>>                                 "proj=latlong"

> 

>>> 

> 

>>>                                 "ellps=GRS80"

> 

>>> 

> 

>>>                                 "init=epsg:4326"

> 

>>> 

> 

>>>                 END

> 

>>> 

> 

>>>                 TYPE polygon

> 

>>> 

> 

>>>                 STATUS ON

> 

>>> 

> 

>>>                 TRANSPARENCY 70

> 

>>> 

> 

>>>                 CLASS

> 

>>> 

> 

>>>                                 NAME "MLRA"

> 

>>> 

> 

>>>                                 COLOR 0 200 0

> 

>>> 

> 

>>>                                 OUTLINECOLOR 0 0 0

> 

>>> 

> 

>>>                                 EXPRESSION( "[MLRARSYM]" in

> 

>>> 

> 

>> 

>
"102A,102B,102C,103,104,105,106,107A,107B,108A,108B,108C,108D,109,110,111A,1

> 

>>> 11B,111C,111D,111E,112,113,114A,114B,115A,115B,115C" )

> 

>>> 

> 

>>>                 END

> 

>>> 

> 

>>>                 METADATA 

> 

>>> 

> 

>>>                                 qstring_validation_pattern ".*"

> 

>>> 

> 

>>>                 END

> 

>>> 

> 

>>> END

> 

>> 

> 

>> _______________________________________________

> 

>> mapserver-users mailing list

> 

>> mapserver-users at lists.osgeo.org 

> 

>> http://lists.osgeo.org/mailman/listinfo/mapserver-users





More information about the MapServer-users mailing list