[fusion-users] Re: Show Layer added in MapScript
millsde
millsde at dfo-mpo.gc.ca
Wed Mar 24 13:27:02 EDT 2010
I'm adding a point to the map instead of a layer. I tried doing what you
suggested(or at least I think I am) for the past week now, but cannot get
the updated map to show up in the fusion window. Although if I save the
image( using $image->saveWebImage() ) the point displays correctly. Can you
see what I'm doing wrong in my code snip-it?
javascript code ---------------------------------------------------
.
.
.
handler: function(button) {
if (button == 'Add') {
var lat = this.dialog.getValue('Latitude');
var longit = this.dialog.getValue('Longitude');
var map = Fusion.getMapByIndice(0);
var session = 'session='+map.getSessionID();
var mapName = '&mapname='+ map.getMapName();
var latparam = '&latitude='+lat;
var longparam = '&longitude='+longit;
var params = session+mapName+latparam+longparam;
var options = {parameters:params, onSuccess:
this.APResults.bind(this)};
new Ajax.Request(this.queryURL, options);
}
this.dialog.close();
},
APResults: function(r) {
var mainMap = this.getMap();
var aMaps = mainMap.getAllMaps();
parent.document.getElementById('Map').widget.aMaps[0].reloadMap();
}
php code -----------------------------------------------------
.
.
.
if ( ($_REQUEST["latitude"] != "") && ($_REQUEST["longitude"] != "")) {
$lat = $_REQUEST["latitude"];
$longit = $_REQUEST["longitude"];
}
else {
die('Error: Lat/Long not set');
}
if (isset($_SESSION['maps']) && isset($_SESSION['maps'][$mapName])) {
$map = ms_newMapObj($_SESSION['maps'][$mapName]);
}
else {
die('Error: Map not set');
}
$pLayer = ms_newLayerObj($map);
$pLayer->set("name", "New Point");
$pLayer->set("type", MS_LAYER_POINT);
$pLayer->set("status", MS_ON);
$class = ms_newClassObj($pLayer);
$style = ms_newStyleObj($class);
$style->color->setRGB(255,0,0);
$style->set("symbolname", "circle");
$style->set("size", 10);
$my_point = ms_newpointObj();
$my_point->setXY($lat, $longit);
$image=$map->draw();
$my_point->draw( $map, $pLayer, $image, 0, "New Point" );
/*$image_url=$image->saveWebImage();
echo " $image_url "; */
$map->save($_SESSION['maps'][$mapName]);
--------------------------------------------------------------------
--
View this message in context: http://n2.nabble.com/Show-Layer-added-in-MapScript-tp4716387p4792497.html
Sent from the Fusion Users mailing list archive at Nabble.com.
More information about the fusion-users
mailing list