WMS and UMap

365 views
Skip to first unread message

ccrum

unread,
Apr 12, 2010, 10:12:15 AM4/12/10
to UMapper
I'm trying to incorporate a new WMS layer into an existing map. I've
gone through the examples at both http://ccgi.arutherford.plus.com/website/flex/UMap/UMapFlexWMSDemo/
and http://ccgi.arutherford.plus.com/website/flex/UMap/UMapFlexWMSTrafficDemo/,
downloaded the source and treid to incorporate it into my project.
These both seem like they are custom tile projects where the map is
composed of only the custom tiles and some markers. Is there a way to
add a custom tile layer "on top" of an already existing map using Bing
as the provider? I thought maybe using the TileLayerOverlay and
bringing it in as a GroundOverlay might be an option, but can't seem
to get it to work.

--
You received this message because you are subscribed to the Google Groups "UMapper" group.
To post to this group, send email to uma...@googlegroups.com.
To unsubscribe from this group, send email to umapper+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/umapper?hl=en.

Andrei

unread,
Apr 19, 2010, 11:41:43 AM4/19/10
to UMapper
You can certainly add a new layers on top of already existing
providers. The easiest way would be to create a custom XML provider
and define several overlaying tile sets, here is an example:

<UMapSettings>
<logo>http://www.site.com/providerlogo.jpg</logo>
<mapType>
<name>Google</name>
<caption>Google</caption>
<textColor>0x000000</textColor>
<linkColor>0x7777CC</linkColor>
<copyrightMessage><![CDATA[&copy; 2010 Custom Provider - &lt;a
href="http://www.site.com" target="_blank"&gt;Terms of Use&lt;/
a&gt;]]></copyrightMessage>
<layer>
<minZoom>0</minZoom>
<maxZoom>17</maxZoom>
<url><![CDATA[[server]/vt/v=[version]&x=[x]&y=[y]&z=[z]]]></url>
<version>ap.106</version>
<servers>
<url>http://mt0.google.com</url>
<url>http://mt1.google.com</url>
<url>http://mt2.google.com</url>
<url>http://mt3.google.com</url>
</servers>
</layer>
<layer>
<minZoom>0</minZoom>
<maxZoom>17</maxZoom>
<alpha>0.3</alpha>
<url><![CDATA[[server]customtileurl=&x=[x]&y=[y]&z=[z]]]></url>
<servers>
<url>http://www.site.com/providers/tiles/</url>
</servers>
</layer>
</mapType>
</UMapSettings>

Catalin Stefan

unread,
Apr 1, 2013, 9:55:30 AM4/1/13
to uma...@googlegroups.com, and...@umapper.com
Tested this approach and it works.....adding layers to the current mapType.
ex:
var newLayer:TileLayer = new TileLayer("BASE_URL", 1 ,21);
newLayer.addServer("SERVER");
currentMapType.addLayer(newLayer);
uMap.setMapType("road");

But i need to be able to easily manage existing layers  adding/removing.
Could you reply with a small ex how to use the class TileLayerOverlay?
I couldn't manage to load any tile with it...no examples either.

Thanks

Erich Erlangga

unread,
Apr 2, 2013, 10:51:00 AM4/2/13
to uma...@googlegroups.com
Hello,

Based on this TileLayerOverlay API docs, the class is actually a wrapper class for ITileLayer interface.
To use it, just wrap a TileLayer class or a Custom TileLayer Class inside TileLayerOverlay.
From your working script, try something like this:

var newLayer:TileLayer = new TileLayer("BASE_URL", 1 ,21);
newLayer.addServer("SERVER");
var newTileLayer:TileLayerOverlay = new TileLayerOverlay({tileLayer:newLayer}); 

//then you can treat the newTileLayer just like any other overlay object
map.addOverlay(newTileLayer);//Add as overlay mapobjectcontainer 
map.removeOverlay(newTileLayer);
newTileLayer.alpha = 0.6; //setting transparency 

BTW, you can add your newly created TileLayerOverlay to mapobjectcontainer directly like the above example.
You can also add it to a layer. The latter is much easier when you do not want to manually adjusting depth, even
though it is possible:
tileLayerOverlay.owner.setChildIndex(tileLayerOverlay, depth);

below is a nice script you might find useful
//GENERAL PURPOSE UMAP FUNCTION
       private function addOverlaysToUmap(map:UMap, ...args:Array):void{
var len:int = args.length;
for(var i:int = 0; i < len; i++)
{
if(args[i] is IOverlay) _map.addOverlay(args[i]);
}
}
private function addOverlaysToLayers(layer:Layer, ...args:Array):void{
var len:int = args.length;
for(var i:int = 0; i < len; i++)
{
if(args[i] is IOverlay) layer.addOverlay(args[i]);
}
}



To unsubscribe from this group and stop receiving emails from it, send an email to umapper+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Catalin Stefan

unread,
Apr 2, 2013, 11:01:56 AM4/2/13
to uma...@googlegroups.com
Thank you!!
Works perfect.

I did check the API docs but i was doing it wrong...something like 
WRONG: var newTileLayer:TileLayerOverlay = new TileLayerOverlay(newLayer);
GOOD: var newTileLayer:TileLayerOverlay = new TileLayerOverlay({tileLayer:newLayer});

That tiny difference was not in the docs.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages