[mapguide-users] Determine if Layer is a Raster Layer
adnan.c
adnan.chughtai at keynetix.com
Wed May 7 06:16:05 EDT 2008
Thank you both for the responses, I managed to get it working using both the
XML file and the code Andy gave.
Here it is in C#
map.Open(resService, mapName);
MgLayerCollection layers = map.GetLayers();
ArrayList layerNames = new ArrayList();
for (int i = 0; i < layers.GetCount(); i++)
{
MgLayer layer = (MgLayer)layers.GetItem(i);
string layerType = layer.GetFeatureGeometryName();
//"Image" for the Autodesk raster provider and "Raster" for
the GDAL provider.
if (layerType != "Image" && layerType != "Raster")
{
layerNames.Add(layer.GetName());
}
}
Andy Morsell wrote:
>
> You can also try looking at the results of
> MgLayerBase::GetFeatureGeometryName() function
>
> http://mapguide.osgeo.org/files/mapguide/docs/webapi/d5/db1/class_mg_layer_b
> ase_1397670802efc84d2fc0a93cac61b3d0.htm#1397670802efc84d2fc0a93cac61b3d0
>
> It will return "Image" for the Autodesk raster provider and "Raster" for
> the
> GDAL provider.
>
> Here's some example code.
>
> $map = new MgMap();
> $map->Open($resourceService, $this->args['MAPNAME']);
> $layers = $map->GetLayers();
> for ($i = 0; $i < $layers->GetCount(); $i++)
> {
> $layer = $layers->GetItem($i);
> echo($layer->GetFeatureGeometryName());
> }
>
> Andy Morsell, P.E.
> Spatial Integrators, Inc.
> http://www.SpatialGIS.com
>
>
--
View this message in context: http://www.nabble.com/Determine-if-Layer-is-a-Raster-Layer-tp17084050p17101660.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list