[Mapserver-users] Re: Mapserver - Itemquery

Richard Greenwood rich at greenwoodmap.com
Fri Jan 17 07:08:30 PST 2003


--=======32FE3149=======
Content-Type: multipart/alternative; x-avg-checked=avg-ok-539216BE; boundary="=====================_91392615==.ALT"


--=====================_91392615==.ALT
Content-Type: text/plain; x-avg-checked=avg-ok-539216BE; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit

Steve,

I am not too familiar with the demos so I can't answer your question in the 
context of the demos, but what you are trying to do isn't hard. Basically 
you need to have just one map file and just one template file for your project.

In your map file, you will need two definitions for the lake layer, one for 
normal display of the lake and another for displaying the lake that has 
been queried. Give the layer definitions different names e.g. LAKE and 
LAKE_QUERIED.

Here's an example (off the top of my head, so it might not be perfect):

QUERYMAP
         STATUS ON
         STYLE SELECTED
END

LAYER   # this layer displays all lakes and allows user to
                 # click on lake and get lake name
         NAME LAKE
         TYPE Polygon
         DATA  "lake"
         status default
         CLASS
                 Name "Lakes"    # this is just for display in the legend
                 TEMPLATE "attribute_display.html"       # Use to display 
attribute data
                 SYMBOL "Solid"
                 OUTLINECOLOR 0 0 255
                 SIZE 2
         END  # CLASS
END  # layer

LAYER   # this layer just displays one lake when it has been queried
                 # for based on lake_id
         NAME "LAKE_QUERY"
         DATA "lake"
         TYPE  polygon
         STATUS default

         FILTERITEM lake_id
         Filter "%kake_id%"
         CLASS
                 TEMPLATE tc.html        # Use to display map
                 OUTLINECOLOR 255 255 0
                 SYMBOL 'solid' SIZE 6
         END # CLASS
END # LAYER

In terms of using javascript to set form variables - you should have to for 
a basic page. You should be able to get everything you describe working 
with standard form controls.

Your template file looks ok, but I think you should add:
         <input type="hidden" name="mapext"   value="shapes">

I will CC this reply to the list because there is always some out there 
with a useful suggestion.

Rich

At 04:37 PM 1/17/2003 +0800, Steve McCrone wrote:

>Hello,
>
>Sorry for mailing directly, but from previous mails and archives you seem 
>quite familiar with CGI mapserver.
>So, if you don't mind me asking you a question -
>
>Let's start with the demo from the mapserver website. The one that starts 
>with demo_init.html,
>demo.map and demo.html, and demo_footer.html & demo_header.html
>
>Here's what I'm after - I wish to combine the case1 demo in the TestSuite 
>with this demo described above.
>In other words, the user selects a lake (from Lakespy2) from a combo box, 
>pushes a button and the
>map will zoom into this lake (on the same page  - demo.html) NOT opening 
>up another page, and highlite it yellow.
>I have the case1 demo working but wish to have it all on the same page.
>
>I have added a combo box and button -
>
>  Pick one:
>   <select name="value" size="1">
>   <option>  BOWSTRING
>   <option>  ALICE
>   </select>
>   <input type="button" value="Go!" onclick="javascript:find()">
>
>where the user selects a 'lake' and then pushes the button. Then the map 
>image zoomed in to this polygon will be loaded
>in the palce of ths img in - <INPUT NAME="img" TYPE="image" SRC="[img]" 
>width=600 height=600 border=0>
>
>Then the user can continue to interact with the map image by zooming 
>in/out/panning etc.
>
>I assume I need to call a javascript function to set the variable etc., 
>which will involve setting such
>variables as -
><input type="hidden" name="mode" value="itemquery">
><input type="hidden" name="qlayer" value="Lakespy2">
><input type="hidden" name="item" value="Lake_name">
><input type="hidden" name="mapext" value="">
>
>But, I'm at a loss on how to have this function within the same page. I 
>also need to set my filters etc in my map page, but when I initially
>load my page the lakespy2 shape file is not loaded.
>
>I have spent hours searching the archive but have not found anyone who has 
>implemented this.
>
>Thanks for any assistance you can provide. I will continue trying.
>
>Steve
>
>
>
>
><

Richard W. Greenwood, PLS
(307) 733-0203
Rich at GreenwoodMap.com
www.GreenwoodMap.com 

--=====================_91392615==.ALT
Content-Type: text/html; x-avg-checked=avg-ok-539216BE; charset=us-ascii
Content-Transfer-Encoding: 8bit

<html>
<body>
Steve,<br><br>
I am not too familiar with the demos so I can't answer your question in
the context of the demos, but what you are trying to do isn't hard.
Basically you need to have just one map file and just one template file
for your project.<br><br>
In your map file, you will need two definitions for the lake layer, one
for normal display of the lake and another for displaying the lake that
has been queried. Give the layer definitions different names e.g. LAKE
and LAKE_QUERIED.<br><br>
Here's an example (off the top of my head, so it might not be
perfect):<br><br>
QUERYMAP<x-tab>        </x-tab><br>
<x-tab>        </x-tab>STATUS ON
<br>
<x-tab>        </x-tab>STYLE
SELECTED<br>
END<br><br>
LAYER<x-tab>   </x-tab># this layer displays all lakes and
allows user to <br>
<x-tab>        </x-tab><x-tab>        </x-tab>#
click on lake and get lake name<br>
<x-tab>        </x-tab>NAME
LAKE<br>
<x-tab>        </x-tab>TYPE
Polygon<br>
<x-tab>        </x-tab>DATA 
"lake"<x-tab>    </x-tab><br>
<x-tab>        </x-tab>status
default<br>
<x-tab>        </x-tab>CLASS<br>
<x-tab>        </x-tab><x-tab>        </x-tab>Name
"Lakes"<x-tab>    </x-tab># this is just
for display in the legend<br>
<x-tab>        </x-tab><x-tab>        </x-tab>TEMPLATE
"attribute_display.html"<x-tab>       </x-tab>#
Use to display attribute data<br>
<x-tab>        </x-tab><x-tab>        </x-tab>SYMBOL
"Solid"<x-tab>  </x-tab><x-tab>        </x-tab><br>
<x-tab>        </x-tab><x-tab>        </x-tab>OUTLINECOLOR
0 0 255<br>
<x-tab>        </x-tab><x-tab>        </x-tab>SIZE
2<br>
<x-tab>        </x-tab>END 
# CLASS<br>
END  # layer <br><br>
LAYER<x-tab>   </x-tab># this layer just displays one lake
when it has been queried<br>
<x-tab>        </x-tab><x-tab>        </x-tab>#
for based on lake_id<br>
<x-tab>        </x-tab>NAME
"LAKE_QUERY"<br>
<x-tab>        </x-tab>DATA
"lake"<x-tab>     </x-tab><x-tab>        </x-tab><x-tab>        </x-tab><x-tab>        </x-tab><br>
<x-tab>        </x-tab>TYPE 
polygon<br>
<x-tab>        </x-tab>STATUS
default<br>
<x-tab>        </x-tab><br>
<x-tab>        </x-tab>FILTERITEM
lake_id<br>
<x-tab>        </x-tab>Filter
"%kake_id%"<x-tab>      </x-tab><br>
<x-tab>        </x-tab>CLASS<br>
<x-tab>        </x-tab><x-tab>        </x-tab>TEMPLATE
tc.html<x-tab>        </x-tab>#
Use to display map<br>
<x-tab>        </x-tab><x-tab>        </x-tab>OUTLINECOLOR
255 255 0<x-tab>  </x-tab><br>
<x-tab>        </x-tab><x-tab>        </x-tab>SYMBOL
'solid' SIZE 6<br>
<x-tab>        </x-tab>END #
CLASS<br>
END # LAYER<br><br>
In terms of using javascript to set form variables - you should have to
for a basic page. You should be able to get everything you describe
working with standard form controls.<br><br>
Your template file looks ok, but I think you should add:<br>
<x-tab>        </x-tab><input
type="hidden" name="mapext"  
value="shapes"><br><br>
I will CC this reply to the list because there is always some out there
with a useful suggestion.<br><br>
Rich <br><br>
At 04:37 PM 1/17/2003 +0800, Steve McCrone wrote:<br><br>
<blockquote type=cite class=cite cite><font face="arial" size=2>Hello,</font><br>
 <br>
<font face="arial" size=2>Sorry for mailing directly, but from previous
mails and archives you seem quite familiar with CGI
mapserver.</font><br>
<font face="arial" size=2>So, if you don't mind me asking you a question
- </font><br>
 <br>
<font face="arial" size=2>Let's start with the demo from the mapserver
website. The one that starts with demo_init.html,</font><br>
<font face="arial" size=2>demo.map and demo.html, and demo_footer.html
& demo_header.html</font><br>
 <br>
<font face="arial" size=2>Here's what I'm after - I wish to combine the
case1 demo in the TestSuite with this demo described above. </font><br>
<font face="arial" size=2>In other words, the user selects a lake (from
Lakespy2) from a combo box, pushes a button and the</font><br>
<font face="arial" size=2>map will zoom into this lake (on the same
page  - demo.html) NOT opening up another page, and highlite it
yellow.</font><br>
<font face="arial" size=2>I have the case1 demo working but wish to have
it all on the same page.</font><br>
 <br>
<font face="arial" size=2>I have added a combo box and button - </font>
<br>
 <br>
<font face="arial" size=2> Pick one:<br>
  <select name="value" size="1"><br>
  <option>  BOWSTRING<br>
  <option>  ALICE<br>
  </select><br>
  <input type="button" value="Go!" onclick="javascript:find()"></font><br>
 <br>
<font face="arial" size=2>where the user selects a 'lake' and then pushes the button. Then the map image zoomed in to this polygon will be loaded</font><br>
<font face="arial" size=2>in the palce of ths img in - <INPUT NAME="img" TYPE="image" SRC="[img]" width=600 height=600 border=0></font><br>
 <br>
<font face="arial" size=2>Then the user can continue to interact with the map image by zooming in/out/panning etc.</font><br>
 <br>
<font face="arial" size=2>I assume I need to call a javascript function to set the variable etc., which will involve setting such </font><br>
<font face="arial" size=2>variables as - </font><br>
<font face="arial" size=2><input type="hidden" name="mode" value="itemquery"><br>
<input type="hidden" name="qlayer" value="Lakespy2"><br>
<input type="hidden" name="item" value="Lake_name"><br>
<input type="hidden" name="mapext" value=""> </font><br>
 <br>
<font face="arial" size=2>But, I'm at a loss on how to have this function within the same page. I also need to set my filters etc in my map page, but when I initially</font><br>
<font face="arial" size=2>load my page the lakespy2 shape file is not loaded.</font><br>
 <br>
<font face="arial" size=2>I have spent hours searching the archive but have not found anyone who has implemented this.<br>
 <br>
Thanks for any assistance you can provide. I will continue trying.<br>
 <br>
Steve<br>
</font> <br>
<font face="arial" size=2> <br><br>
</font> <br>
<font face="arial" size=2><</font></blockquote>
<x-sigsep><p></x-sigsep>
Richard W. Greenwood, PLS<br>
(307) 733-0203<br>
Rich at GreenwoodMap.com<br>
<a href="http://www.greenwoodmap.com/" eudora="autourl">www.GreenwoodMap.com</a></body>
</html>


--=====================_91392615==.ALT--

--=======32FE3149=======--




More information about the MapServer-users mailing list