ClemensFischer / XAML-Map-Control

XAML Map Control Library
Microsoft Public License
205 stars 61 forks source link

how about support for ETRS89 / UTM zone 32N standard? #47

Closed nguyenngocanh94 closed 4 years ago

nguyenngocanh94 commented 4 years ago

i found your project missing this standard and only EPSG:4326 is hard code on MapProjection. in future how about add the ETRS89 / UTM zone 32N option?

ClemensFischer commented 4 years ago

Take a look at the MapProjections library that comes with the source code. It has a GeoApiProjection class where you can pass the WKT of any projections supported by ProjNET4GeoAPI. There is also a derived UtmProjection class where you can directly pass the UTM zone string, but it only supports WGS84.

qxd4869 commented 4 years ago

Good morning. I want to have some follow-up question. When I tried the above solution. Using map tile server like this link does not work: https://www.wmts.nrw.de/webatlas/tiles/webatlas/EPSG_25832_15/{z}/{x}/{y}.png

The map shows up when I use WebMercatorProjection but it does not show the right conversion from long, lat to x, y

ClemensFischer commented 4 years ago

XAML MapControl does not support WMTS. To show a map in EPSG:25832 projection, you have to use a WmsImageLayer and set its ServiceUrl property to a WMS that supports the projection.

qxd4869 commented 4 years ago

Thanks! Let me clarify: So it only supports tile-servers like Open Street Map and Google Map?

ClemensFischer commented 4 years ago

I have now added (a minimal) support for WMTS.

Assuming there is a Map element named map and a text file containing the WKT of the EPSG:25832 projection, you may use it like shown below. Note that you have to pass the WMTS Capabilities document instead of the tile URL template.

map.MapProjection = new GeoApiProjection
{
    WKT = File.ReadAllText("epsg25832.wkt")
};

map.MapLayer = new WmtsTileLayer
{
    CapabilitiesUri = new Uri("https://www.wmts.nrw.de/webatlas/1.0.0/WMTSCapabilities.xml"),
    LayerIdentifier = "webatlas",
    SourceName = "NRW webatlas" // for caching
};