TR : [rosa-users] php-Rosa applet tile indexing
Frank Broniewski
Frank.Broniewski at mnha.etat.lu
Wed Jan 26 03:23:48 EST 2005
Frank Broniewski
Musée National d'Histoire et d'Art
Section Préhistoire / Projet EPC
Tél: +352 260 281-21
241, Rue de Luxembourg
L-8077 Bertrange
-----Message d'origine-----
De : Frank Broniewski [mailto:frank.broniewski at mnha.etat.lu]
Envoyé : Mittwoch, 26. Januar 2005 09:23
À : 'Palanisamy, Giri'
Objet : RE : [rosa-users] php-Rosa applet tile indexing
Hello
You cannot call a group like this. There is the possibility of getting all
group names in your mapfile with the function getAllGroupNames(). With the
function getLayersIndexByGroup($groupname) you get all layers associated to
a group by index. Then you can cycle through your layers and turn them on or
off. I will post the code for my legendcreation, so you can see above code
in action :-)
function LayerControl(&$MapObj) {
/*
Creates the Legend with Icons depending on the mapfile of the mapserver and
the selection of the user Which Layer can be accessed by what usertype can
be defined in the mapfile by using the "access" Keyword in the metatags
Legend is arranged in Groups, which are defined in the mapfile */
$MapLayers = $MapObj->getAllLayerNames();
$MapGroups = $MapObj->getAllGroupnames();
sort($MapGroups); // sorts GroupLayers from Mapfiles alphabeticly for
display
foreach($MapGroups as $groupname) {
echo "<p><span
class=\"legendgroup\">".htmlentities($groupname)."</span><br>\n";
$LayerObjIndex = $MapObj->getLayersIndexByGroup($groupname);
foreach($LayerObjIndex as $layerindex) {
$LayerObj = $MapObj->getLayer($layerindex);
if ($LayerObj->getMetaData("access") <= $_SESSION['status']) { // Here
we check, which layer can be seen by which usertype
echo "<input type=\"checkbox\" name=\"layer[]\"
value=\"".$LayerObj->name."\" ".ReturnMapStatus($LayerObj->name,
$MapObj).">: ".htmlentities($LayerObj->name)."<br>\n";
if (isset($_POST['ShowLegend'])) { // If user wants to see the
icons, then create them
for ($i = 0; $i < $LayerObj->numclasses; $i++) {
$ClassObj = $LayerObj->GetClass($i);
$LegendiconObj = $ClassObj->createLegendIcon(10, 10);
$iconpath = $MapObj->web->imagepath;
$webpath = $MapObj->web->imageurl;
$ClassObjName = DelSpecChars($ClassObj->name);
$iconpath = $iconpath.$ClassObjName.$i.".png";
$iconurl = $webpath.$ClassObjName.$i.".png";
$LegendiconObj->saveImage($iconpath);
echo "<img class=\"legendimg\" src=\"".$iconurl."\"
alt=\"Legendicon\"> <span
class=\"legendfont\">".htmlentities($ClassObj->name)."</span><br>\n";
} // for numclasses
} // if showlegend
} // if status
} // foreach layer
echo "</p>\n";
} // foreach group
}
Frank Broniewski
Musée National d'Histoire et d'Art
Section Préhistoire / Projet EPC
-----Message d'origine-----
De : rosa-users-bounces at lists.maptools.org
[mailto:rosa-users-bounces at lists.maptools.org] De la part de Palanisamy,
Giri Envoyé : Dienstag, 25. Januar 2005 23:04 À :
rosa-users at lists.maptools.org Objet : [rosa-users] php-Rosa applet tile
indexing
Hi,
I am able to customize the GMap php-rosa sample app. I have the following
layer in my .map file, I am using TILEINDEX for 8km and 1km resolution and
the top level 50 km I am using tif file. In by JBox I used to call this
layer by the GROUP " MOD12Q1" and it worked, now in the php application how
do I call this group? Is there similar method call like getlayerbyname() for
LAYER GROUP?
$poLayer = $gpoMap->getlayerbyname("IGBP_MOD12Q1");
$poLayer->set("status", 1);
Returns
Warning: getLayerByName failed for : IGBP_MOD12Q1 in
f:\Inetpub\wwwroot\gmap\htdocs\gmap75.inc.php on line 116
Any suggestion would be highly appreciated
Thanks!
Giri
Here is my layer snippet from the .map file
LAYER
NAME IGBP_50k
GROUP IGBP_MOD12Q1
TYPE RASTER
DATA LL_SDS01GR50.tif
STATUS ON
MINSCALE 1490000
MAXSCALE 190000000
#MAXSCALE 10000
PROJECTION
"proj=longlat"
"ellps=GRS80"
"no_defs"
END
END
LAYER
NAME IGBP_8K
GROUP IGBP_MOD12Q1
TYPE RASTER
STATUS ON
TILEINDEX "modis_8km"
TILEITEM "Location"
MINSCALE 29000000
MAXSCALE 150000000
PROJECTION
"proj=longlat"
"ellps=GRS80"
"no_defs"
"proj=eqc"
END
END
LAYER
NAME IGBP_1K
GROUP IGBP_MOD12Q1
TYPE RASTER
STATUS ON
TILEINDEX "modis_1km"
TILEITEM "Location"
#MINSCALE 8000000
MAXSCALE 30000000
PROJECTION
"proj=longlat"
"ellps=GRS80"
"no_defs"
"proj=eqc"
END
END
Giri
_______________________________________________
ROSA-users mailing list
ROSA-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/rosa-users
More information about the ROSA-users
mailing list