Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

WMS layers on MapControl

$
0
0

Hi - how can I add a WMS layer with GeoGrphic information to a map control? We' re trying to build a portable app and want to project WMS layers on a map. In the regular Windows 8.1 project we succeed in adding a HttpMapTileDataSource and binding it to a Windows.UI.Xaml.Controls.Maps.MapControl, but could not find an equivalent in the Xamarin MapControl. Below a fragment of what we want, where GlobalMercator is a seprate class for the transformation and bounding box calculations:

HttpMapTileDataSource dataSource = new HttpMapTileDataSource();
dataSource.UriRequested += new TypedEventHandler<HttpMapTileDataSource, MapTileUriRequestedEventArgs>(
(source, args) => {
Rect mercBounds = GlobalMercator.TileBounds(new Tile(args.X, args.Y), args.ZoomLevel);
args.Request.Uri = new Uri(string.Format(_wmsUrl, mercBounds.Left, Math.Abs(mercBounds.Bottom), mercBounds.Right, Math.Abs(mercBounds.Top))); ;
});

        _map.TileSources.Add(new MapTileSource(dataSource));

Hope someone can point us in the right direction.> >


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>