[mapserver-users] Displaying a point given its latitude andlongitude
Emerson, Gabe
gemerson at WelshCo.com
Wed Aug 20 06:23:00 PDT 2008
I'm not sure about mapscript methods, but the older html method works
for me. I would think you could use mapscript to insert inline features
using something like $layer->set('values');
I use a dummy layer which sets up the appearance of the point, and then
add features to the layer as needed via a form variable. Once I have a
lat/lon pair (I'm getting them from a geocoding API), I set a form
variable representing my dummy layer with the values I want inserted
into that layer.
These docs were useful when I set this up:
http://mapserver.gis.umn.edu/docs/reference/cgi/controls
(scroll down to "Changing map file parameters via a form or a URL")
http://mapserver.gis.umn.edu/docs/reference/vector_data/inline
Here's what my dummy layer looks like:
LAYER
NAME "as" #Small scale (zoomed out)
STATUS off #layer must be specified ON
or DEFAULT in URL for it to be drawn
TYPE point
UNITS dd
PROJECTION
"init=epsg:4326"
END
#Features get inserted here, specified
in URL
CLASS
NAME "Search Result"
LABEL #Label text gets
inserted via URL
FONT
"futura"
TYPE
TRUETYPE
POSITION
lc
SIZE 12
WRAP "%"
#newline when % encountered in string
BUFFER 1
COLOR 0
0 0
BACKGROUNDCOLOR 255 255 255
BACKGROUNDSHADOWCOLOR 204 204 204
BACKGROUNDSHADOWSIZE 3 3
FORCE
TRUE
END
STYLE
SYMBOL
"house"
COLOR
255 0 0
SIZE 15
END
END
END
Here's the on-the-fly feature point creation using Javascript (in the
map template):
document.mapserv[0].value="FEATURE POINTS "+Ylon+" "+Ylat+" END TEXT
'"+Yaddr+"%"+Ycity+", "+Ystate+" "+Yzip+"' END"; //Get lat long into
layer
document.mapserv[1].value="STATUS default"; //Turn on dummy layer in
mapfile.
I have two form variables named map_layer[as], which mapserver
interprets as representing the mapfile layer "as". When you submit the
form, the value of map_layer[as] in the URL gets set to the appropriate
part of the "as" layer in the mapfile. Two copies of this variable are
needed since I need to change both the FEATURE POINTS and the STATUS of
the layer (to turn it on and off as needed).
Here's the mapserv[0] and mapserv[1] variables that the javascript is
editing:
<input type="hidden" name="map_layer[as]" value="[inlinelayer]">
<input type="hidden" name="map_layer[as]" value="[layerstatus]">
The default variables inlinelayer and layerstatus let me maintain my
points from state to state until cleared by a user control.
-Gabe
From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of ramya
srinivasan
Sent: Wednesday, August 20, 2008 5:09 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] Displaying a point given its latitude
andlongitude
Hello,
How to display a point in the map given its latitude and longitude.R
there any methods under php/mapscript to do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20080820/87a19091/attachment.htm>
More information about the MapServer-users
mailing list