Wmts requests

Nov 22, 2013 at 3:08 PM
Edited Nov 22, 2013 at 3:09 PM
Hi Paul,

I'm curently playing with the IGN api thanks to your WMTS implementation.
To make it work, I had to make some modifications as follow:
  • First of all, in WmtsParser.cs, I needed to replace layer.Title.First().Value and layer.Title[0].Value by layer.Identifier.Value. In fact, the "Layer" url parameter of a GetTile request needed the Identifier, not the Title.
  • Also, in the same file, I needed to modify this:
    foreach (var tileMatrix in tileMatrixSet.TileMatrix.OrderByDescending(x => x.ScaleDenominator))
    This was very important because you need to be sure that the IDictionary Resources is sorted descending way for further comparisons (important for zoom management).
  • Also, the IGN api need to recieve a Http Header containing the User-Agent (could be Android or iOS in this case) so I needed to change the HttpWebRequest to HttpRequestMessage with HttpClient.. Feel free to ask me for my modifications.
Don't know if it was only for my personal use or if it could be useful for you and other users.

ps: sorry for my aprox English :)
Coordinator
Nov 23, 2013 at 7:00 AM
Hi jbrunpicard,

The WMTS client is still in development. Last week was the first time we had a sample running of the dutch 'ign api' (pdok). In parts I know the current implementation to be incorrect. Every time I use First() it is a temporary solution. So I am happy to see you got it working.

Do you have sample code on how to create a ign service? Perhaps I should add it to my samples.

On 11/22/2013 5:08 PM, jbrunpicard wrote:

From: jbrunpicard

Hi Paul,

I'm curently playing with the IGN api thanks to your WMTS implementation.
To make it work, I had to make some modifications as follow:
. first of all, in WmtsParser.cs, I needed to replace layer.Title.First().Value and layer.Title[0].Value by layer.Identifier.Value. In fact, the "Layer" url parameter of a GetTile request needed the Identifier, not the Title.
ah, thanks. This was not detected in my tests because in the pdok sample Title and id are the same and in the Vienna sample this part is already filled in in the ResourceUrls.
. Also, in the same file, I needed to modify this:
foreach (var tileMatrix in tileMatrixSet.TileMatrix.OrderByDescending(x => x.ScaleDenominator))
This was very important because you need to be sure that the IDictionary Resources is sorted descending way for further comparisons (important for zoom management).
I recently changed the resolutions dictionary from <int, Resolution> to <string, resolution>. I was thinking to let the sorting be the responsibility of the clients that do the zooming, but it is an extra burden. Perhaps I should add a ToSortedList extention method on the dictionary.
. Also, the IGN api need to recieve a Http Header containing the User-Agent (could be Android or iOS in this case) so I needed to change the HttpWebRequest to HttpRequestMessage with HttpClient.. Feel free to ask me for my modifications.
I would like to see the source code for this. I was planning to start using HttpClient as well.

Did you use this as part of the PCL?

Don't know if it was only for my personal use or if it could be useful for you and other users.

ps: sorry for my aprox English :)

Thanks for you feedback!

Paul

Nov 23, 2013 at 1:00 PM
pauldendulk wrote:
Hi jbrunpicard, The WMTS client is still in development. Last week was the first time we had a sample running of the dutch 'ign api' (pdok). In parts I know the current implementation to be incorrect. Every time I use First() it is a temporary solution. So I am happy to see you got it working. Do you have sample code on how to create a ign service? Perhaps I should add it to my samples.
First of all, congrats for this awsome work! I think it would be nice to get something like "new IgnTileSource" so yes Ishould be interesting to add it.
You have to create your own api key HERE
Then you'll get addresses to use into your requests.

About that, 3 things to know:
  • You're not allowed to cache tiles from IGN for an offline use as you don't pay for it. So, I was wondering if there's already an option in Brutile like a bool UseCache true/false when you create the new TileSource or if it's a need to add?
  • You're not allowed to create a private acces like login/pass to be able to see the IGN map as you don't pay for it (in fact, to be free, IGN tiles need to be used only for an online public context, if not you have to pay for it)
  • IGN servers need to get the User-Agent into the header so you need to use HttpClient requests to deal with it.
pauldendulk wrote:
I was thinking to let the sorting be the responsibility of the clients that do the zooming, but it is an extra burden. Perhaps I should add a ToSortedList extention method on the dictionary.
Well in my opinion, we could pre-filter the résolution dictionary with the ToSortedList extention in a descending way. Clients could resort it as they want if needed. What do you think?

pauldendulk wrote:
I would like to see the source code for this. I was planning to start using HttpClient as well. Did you use this as part of the PCL?
Yes I use it in the PCL profile 158, but as you can't access to it by default in this context:
  • You have download the latest version of NuGet
  • Then add the Microsoft BCL HTTP and Async references from NuGet to your PCL project
  • Then I created an HttpRequestExtention class (Extention namespace) and an HttpRequestHelper class (Web namespace)
I could send you my files by email if needed

Jeremy.
Coordinator
Nov 25, 2013 at 6:22 AM
Hi Jeremy,

Some inline reactions.

On 11/23/2013 3:00 PM, jbrunpicard wrote:

From: jbrunpicard

pauldendulk wrote:
Hi jbrunpicard, The WMTS client is still in development. Last week was the first time we had a sample running of the dutch 'ign api' (pdok). In parts I know the current implementation to be incorrect. Every time I use First() it is a temporary solution. So I am happy to see you got it working. Do you have sample code on how to create a ign service? Perhaps I should add it to my samples.
First of all, congrats for this awsome work! I think it would be nice to get something like "new IgnTileSource"
That is in line with the current OsmTileSource, but I was actually trying to move away from that. BruTile was initially meant as library of components that can be combined into specific tilesources, but gradually specific tile sources have gotten a more prominent role. So I now think I create a single class that creates all specific instances. Everything else should be generic. So I will remove OsmTileSource and OsmRequest altogether.

So there should be a KnownTileSource.Create(KnownTileSource.Ign) which internally perhaps only parses the capabilities url. Also we have to deal with the choice in layer, style and tileMatrix, perhaps as extra parameters with default values to not confuse people starting with it.

so yes Ishould be interesting to add it.
You have to create your own api key HERE
Then you'll get addresses to use into your requests.

About that, 3 things to know:
  • You're not allowed to cache tiles from IGN for an offline use as you don't pay for it. So, I was wondering if there's already an option in Brutile like a bool UseCache true/false when you create the new TileSource or if it's a need to add?
  • You're not allowed to create a private acces like login/pass to be able to see the IGN map as you don't pay for it (in fact, to be free, IGN tiles need to be used only for an online public context, if not you have to pay for it)
  • IGN servers need to get the User-Agent into the header so you need to use HttpClient requests to deal with it.
ah that is not very open. Similar to Google and Bing. I would expect more openness from the IGN. We should add it anyway. The users themselves have the responsibility to use it properly.

pauldendulk wrote:
I was thinking to let the sorting be the responsibility of the clients that do the zooming, but it is an extra burden. Perhaps I should add a ToSortedList extention method on the dictionary.
Well in my opinion, we could pre-filter the résolution dictionary with the ToSortedList extention in a descending way. Clients could resort it as they want if needed. What do you think?
Thats how it was with the integer dictionary key. And in my Mapsui implementations I recursively searched through the list for available tiles using the integer to get the current level and go through the next (nextLevel = level+1). So I need a little more than a sorted string dictionary. I'll have to think about it a little more. It's an important part of the library so it's important to get it right.

pauldendulk wrote:
I would like to see the source code for this. I was planning to start using HttpClient as well. Did you use this as part of the PCL?
Yes I use it in the PCL profile 158, but as you can't access to it by default in this context:
  • You have download the latest version of NuGet
  • Then add the Microsoft BCL HTTP and Async references from NuGet to your PCL project
  • Then I created an HttpRequestExtention class (Extention namespace) and an HttpRequestHelper class (Web namespace)
I could send you my files by email if needed
Yes please. Profile 158 has .net 4.5 iso 4.0.3 that is an upgrade I could accept. BruTile still needs to compile for 4.0 though. I guess I need to write some #if code for that.

Paul



Jeremy.