Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Rewrite Map Tiles requests from TMS to XYZ and vice versa |
|
Author |
|
tenly
Joined: 10 Apr 2014 Posts: 3 Location: Canada, Toronto
|
Posted: Wed 03 Aug '16 4:24 Post subject: Rewrite Map Tiles requests from TMS to XYZ and vice versa |
|
|
I have a custom Map with tiles generated using Google's XYZ co-ordinate system. There are 2 applications that need to consume the tiles - both are out of my control. One of them requests the tiles in the same XYZ co-ordinate system they are saved in - but the other app requests them using the TMS co-ordinates which results in a request for a different filename.
The map tiles are requested using a URL that starts with a subdirectory for the zoom level, followed by a Y co-ordinate as a subdirectory and finally an X co-ordinate which is a filename. It is the filename that is different for each co-ordinate system since one starts numbering tiles in the top left corner of the grid and the other starts in the bottom left. I believe there is a simple formula that can be used to convert between the 2 co-ordinate systems.
So...I currently have my map tiles stored in the native XYZ directory structure in which they were generated - and apps can request the tiles using the following style URL:
http://server/mapdata/x/y/filename.png
What I would like to do is to create a second URL which looks like: (adds the tms)
http://server/mapdata/tms/x/y/filename.png
...and when this URL is used, I'd like to trigger a formula which translates the incoming TMS filename (a 6 digit numeric value) to the correct equivalent XYZ filename and then rewrites the entire URL to match the one in the first paragraph above.
I'd actually be really surprised if something like this did not already exist - but I've spent a couple of hours searching and can't find what I need.
My only other alternative is to download a batch file rename tool and make a second copy of all of my map data that is stored with the alternate file names - which seems like a big waste of time and disk space.
I'm open to other suggestions that will make this work - as long as the suggestion is not "ask both consumers of the data to use the same co-ordinate system for their requests".
Thanks in advance for anyone that can point me in the right direction... |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7364 Location: Germany, Next to Hamburg
|
Posted: Wed 10 Aug '16 11:51 Post subject: |
|
|
What language do you use for your code?
However why don't you rewrite a non existing tms folder to your app and use that images.
Am I right that /mapdata/tms/5/6/filename.png shall use /mapdata/5/6/filename.png? |
|
Back to top |
|
|
|
|
|
|