Greetings,
I am looking at the code sample on the requesting of XYZ webtiles using an extent and rendering of a map:
var mapPath = Path.Combine(RunExamples.GetDataDir(), "out_osm_tiles.png");
// we use the osm tile server
string url = "http://tile.openstreetmap.org/{z}/{x}/{y}.png";
using (var layer = Drivers.XyzTiles.OpenLayer(new XyzConnection(url)))
{
// print tiles info
var extent = new Extent(-90, -40, 90, 40) {SpatialReferenceSystem = SpatialReferenceSystem.Wgs84};
var tiles = layer.GetTiles(2, extent).ToList();
// render tiles
var resampling = new RasterMapResampling() { Height = 800, Width = 800 };
using (var map = new Map(800, 800))
{
foreach (var tile in tiles)
{
var raster = tile.AsRaster();
map.Add(new RasterMapLayer(raster) { Resampling = resampling });
}
map.Render(mapPath, Renderers.Png);
}
Console.WriteLine($"Rendered Map: {mapPath}");
Similarly, I should be able to open/create a geometry, or read from WKT or shapefile and add to a layer, then refer to the geometry of the layer by using layer.GetExtent method.
However, if I change the above sample by using
var tiles = layer.GetTiles(2, mylayer.GetExtent).ToList();
and then add both the rastermaplayer and vectorlayer in rendering the map, the resulting image does not align the way I assumed the two layers would align.
Am I missing something simple? I would have thought I could overlay the vector layer on top of the rastermaplayer, and then even add icon marker images on top.
Thanks