[mapguide-users] Add point to map

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Sep 14 05:05:12 EDT 2009


If I understand correctly, you want to draw features on the map.
This is usually called redline or redlining, so searching for that 
should yield a few examples.

The process is this:
1) Create a FeatureSource (or re-use one)
2) Insert geometry into FeatureSource (point in your case)
3) Create a LayerDefinition that describes how to display the geometry, 
and references the FeatureSource.
4) Insert the layer in the runtime map
5) Refresh the client

I have written about this numerous times, so you should be able to find 
good examples in the archives.
Also, all steps are performed with the Buffer code in the AJAX viewer.
Simply open buffer.(aspx|jsp|php) and you can see each step in your 
favored language.

Regards, Kenneth Skovhede, GEOGRAF A/S



Paulo Veríssimo skrev:
> Hi
>
> I'm trying to do a simple job with Mapguide Enterprise 2010 and php 
> but I'm not being succefull.
> Hope someone can help.
>
> The goal is to add a session point to a layer from a sdf feature 
> source already created. May be another one, if it becomes easier.
> I already have a page where the user inputs the coordinates and scale 
> and the piece of javascript does the zoom and scale but than I want to 
> draw a point at that location calling a php page with all the needed 
> parameters including the coordinates.
>
> What's the code for this final php file to add a point to the map?
>
> Here is the code for the input page:
>
> <script language='javascript'>
> function gotoxy()
> {    var coords=document.gotoxyform.inputbox.value;
>     if(coords.indexOf(',')>0)
>     {    var coordsplit=coords.split(',');
>         {    if(coordsplit.length==2)
>             {    var coordx=parseFloat(coordsplit[0]);
>                 var coordy=parseFloat(coordsplit[1]);
>                 var scale=parseFloat(document.gotoxyform.scalebox.value);
>                 parent.parent.mapFrame.ZoomToView(coordx, coordy, 
> scale, true);
>             }
>             document.location="zoomxy_execute.php?SESSION=<?= 
> $sessionId ?>&MAPNAME=<?= $mapName ?>&x="+coordx+"&y="+coordy;
>         }
>     }
> }
> </script>
>
>
> <form name='gotoxyform' action='javascript:gotoxy()' method='post'>
>     Input coordinates:
>     <input name='inputbox' value="-99000,-99000">
>     <br>
>     Input Scale:
>     <input name='scalebox' value="20000">
>     <br>
>     <input value='Zoom' type='submit'>
> </form>
>
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list