working with zoompoint using geographic coordinates {Scanned} {Scanned}

Siki Zoltan siki at AGT.BME.HU
Sat Aug 28 06:52:15 EDT 2004


Hi,

To be more specific ...
I do something similar to find a parcel on the map and zoom to it.
I have no image in the form.

      <form method="GET" name="mapserv1" action="/cgi-bin/mapserv">
        <input type="hidden" name="map"
value="full_path_to_your_map_file">
<-- here I set the neccessary cgi variables -->
        <input type="hidden" name="imgext" value="[mapext]">
        <input type="hidden" name="mapext" value="shapes">
        <input type="hidden" name="imgsize" value="[imgsize]">
        <input type="hidden" name="mapsize" value="[mapsize]">
        <input type="hidden" name="savequery" value="true">
        <input type="hidden" name="mode" value="itemnquery">
        <input type="hidden" name="qlayer" value="telek">
        <input type="hidden" name="qitem" value="hrsz">
        <input type="hidden" name="layers" value="[layers]">
        <input type="hidden" name="selbutton" value="[selbutton]">
<-- here is the input field from the user (it may be coordinates) -->
        <input type="hidden" name="qstring" value="">
        HRSZ:
        <input type="text" name="hrsz" onkeyup="js_pressenter(document.mapserv1)">
<-- i use javascript to check the input and submit the form -->
        <input type="button" value="Keres" onClick="js_changeqstring()">
      </form>

You shoud do something similar but you set the coordinates in the units
you define in your map file. You should set mapxy and scale cgi variables.

Without testing i would write:

      <form method="GET" name="zoomtoxy" action="/cgi-bin/mapserv">
        <input type="hidden" name="map" value="your_map_file">
        <input type="hidden" name="scale" value="2000">
        <input type="hidden" name="layers" value="layer list space
separated">
        <input type="text" name="mapxy"> <-- enter x y space separated -->
        <input type="submit" value="Submit">
      </form>

Probably you must set other cgi variables, i suppose imagexy, imagesize,
etc. Of course you need a html template beside the map file.

I hope this helps you.

Bye
Zoltan


 On Fri, 27 Aug 2004, Bob Cook wrote:

> I need to perhaps be more specific:
>
> Here is my original question:
> > I would like my map of the United States and its territories to have a
> > feature that allows a user to type in a latitude and longitude in form
> > input fields (e.g., lat: 40N long: 88W), then have the map pan to that
> > point, and zoom in.
>
> I am using PHP-Mapscript.
>
> My map is using a projection. (I'm not sure if this is relevant, but I
> think it might be).
>
> I know that mapserver can pan and zoom to a given point on the map
> (the $mapObj->zoompoint() method will do this), but the point you give
> the method seems to need to be a point with x,y coordinates that are
> in pixels.
>
> So I need to be able to somehow translate latitude and longitude values
> into pixel values..?
>
> Or is there some other way to do get values like 40N, 88W into values
> that mapserver can use to create the boundaries (extents) of the map
> with the latitude and longitude at its center?
>
> Another way of asking this question might be: how to numbers for latitude
> and longitude map onto a mapfile's extent attributes?
>
> Thanks,
> -Bob Cook
>
>
> On Fri, Aug 27, 2004 at 09:40:29PM -0100, Siki Zoltan wrote:
> > Hi,
> >
> > You can do it with cgi mapserver. Check mapxy, scale, mapsize, etc.
> > cgi variables. You can create a form with input fileds having the name
> > of the mapserver cgi variables (some hidden field neccessary e.g. map) and
> > submit it to the maserv cgi. You can use javascript to checkthe input
> > values.
>
> Thanks for your quick reply. However, I'm not sure I completely
> understand your response. Are you saying that if I use cgi mapserver
> that it will automatically translate 40N 88W into a point on the map and
> allow me to zoom in with it as the center? Something like:
>
> <form>
> .
> .
> .
> <input type="image" name="map" src="[map]"/>
> <input type="text" name="latitude" value=""/>
> <input type="text" name="longitude" value=""/>
> .
> .
> <input type="submit" name="submitLatLong" value="Submit"/>
> </form>
>
> Is all I need? CGI Mapserver will handle the rest?
>
> > On Fri, 27 Aug 2004, Bob Cook wrote:
> >
> > > I'm relatively new to mapserver, so I may be trying to do something that
> > > can't be done easily.
> > >
> > > I would like my map of the United States and its territories to have a
> > > feature that allows a user to type in a latitude and longitude in form
> > > input fields (e.g., lat: 40N long: 88W), then have the map pan to that
> > > point, and zoom in.
> > >
> > > Is there any way of doing this?
> > >
> > > Thanks,
> > > -Bob Cook
> > >
>
> --
> /************************************************************\
> * Bob Cook             Software Engineer - OJC Technologies  *
> * bcook at ojctech.com    Engineering From the Right Brain      *
> *                       217-278-3933                         *
> *                                                            *
> *         "Kyrie Eleison...Dona Nobis Pacem"                 *
> *                                                            *
> *                                                            *
> \************************************************************/
>



More information about the mapserver-users mailing list