Is there a conversion from xamGeographicMap tile x,y to geographic coordinates (lat, long)?

StackOverflow https://stackoverflow.com/questions/19191017

質問

I'm trying to get my xamGeographicMap (in the Infragistics WPF controls) to retrieve its background tiles from a WMS service running on an internal GeoServer. This service requires that you provide it with a lat/long bounding box as opposed to tile x/y positions. However, when I override GetTileLayers in my derived MapTileSource, I am only provided with tilePositionX, tilePositionY, and tileLevel. How do I convert this to lat/long?

I ran into a similar issue when I was trying to hook up the Bing Maps WPF Control to the same service, but it was resolved by the TileSystem class provided here: http://msdn.microsoft.com/en-us/library/bb259689.aspx. I tried using the same conversion class with the xamGeoGraphicMap to no avail.

役に立ちましたか?

解決

It turns out that you actually can use the TileSystem class provided on MSDN for this. My error was in assuming that tileLevel was equal to zoom. After looking at some of the example Infragistics example code, I ran across the following line:

var zoom = tileLevel - 8;

Using this conversion in a call to TileSystem.PixelXYToLatLong, I was able to get the values I needed. Make sure that you convert you bounds from degrees to meters if your WMS service is expecting meters.

他のヒント

You should write custom methods for this, since there aren't any built-in ones.

In the Infragsaitics forums a similar question is discussed. You can see the sample attached there:

http://www.infragistics.com/community/forums/p/84442/423636.aspx#423636

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top