melowntech / vts-mapproxy

VTS Mapproxy
BSD 2-Clause "Simplified" License
30 stars 5 forks source link

link to new surface? #20

Closed jrjdavidson closed 2 years ago

jrjdavidson commented 2 years ago

I currently have a surface called "linz-NZ8mDEM". I would like, in the future, to have all request of "linz-NZ8mDEM" to a new (better) surface called "linz-NZ8mDEMSquare". My first thought was just to replace the surface configuration in the resources.json file to the new one, but from memory that was a bad idea as the configuration of an id gets frozen by mapproxy, correct? Is it possible to provide a link of some kind, maybe at the map-config level?

All in all, I'm trying to save myself having to change the configuration of dozens of files..

jrjdavidson commented 2 years ago

Is it possible that tte vts relocate tool is used for this? in that case, what rule would i write to get the new tileset to display instead of the old one?

vaclavblazek commented 2 years ago

vts --relocate manipulates a vts storage to change URL of external tileset, i.e. if you'd have your linz resource used in an existing resource, renamed it in mapproxy (described later) and you'd want to use the it's new URL instead of the original in the existing resource.

Well, mapproxy does not have means to rename resource, however you may to do it manually, if feeling brave enough:

  1. stop mapproxy
  2. duplicate the original resource's for ID with NEW_ID in your resource configuration
  3. locate the original resource's directory in mappoxy store: /var/vts/mapproxy.back/store/melown2015/GROUP/ID
  4. copy the directory to new path to /var/vts/mapproxy.back/store/melown2015/GROUP/NEW_ID
  5. change ID to NEW_ID in the stored resource /var/vts/mapproxy.back/store/melown2015/GROUP/NEW_ID/resource.json
  6. start mapproxy

Now, you should have two resources for the same data with different IDs. Once you are happy with the change, you can drop the original resource (from config and then from store).

jrjdavidson commented 2 years ago

Thanks for the explanation.

What I really want is to replace an existing surface resource with a different surface (using the same id), but your explanation of duplicating a resource helps. It sounds like by manipulating the data in the map proxy store folder I should be able to remove the old resource. And then pop a new one in its place.

The only issue I can see there is that there might some tiles that are cached?

The reason I am doing this is that glue between this surface and the world dataset is really ugly, and I want to change the location of the seam to somewhere out in the ocean where no one will see it. But I already use this surface in a lot of frontend and don’t want to have to change the ID of the surface in all of the frontend code.

On Wed, 15 Jun 2022 at 18:50, Václav Blažek @.***> wrote:

vts --relocate manipulates a vts storage to change URL of external tileset, i.e. if you'd have your linz resource used in an existing resource, renamed it in mapproxy (described later) and you'd want to use the it's new URL instead of the original in the existing resource.

Well, mapproxy does not have means to rename resource, however you may to do it manually, if feeling brave enough:

  1. stop mapproxy
  2. duplicate the original resource's for ID with NEW_ID in your resource configuration
  3. locate the original resource's directory in mappoxy store: /var/vts/mapproxy.back/store/melown2015/GROUP/ID
  4. copy the directory to new path to /var/vts/mapproxy.back/store/melown2015/GROUP/NEW_ID
  5. change ID to NEW_ID in the stored resource /var/vts/mapproxy.back/store/melown2015/GROUP/NEW_ID/resource.json
  6. start mapproxy

Now, you should have two resources for the same data with different IDs. Once you are happy with the change, you can drop the original resource (from config and then from store).

— Reply to this email directly, view it on GitHub https://github.com/melowntech/vts-mapproxy/issues/20#issuecomment-1156057378, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFBMN2ZGIQIKWPZSNE2Z6LVPF4MLANCNFSM5YZNO2BQ . You are receiving this because you authored the thread.Message ID: @.***>

jrjdavidson commented 2 years ago

Also, if I did want to use vts relocate, what would a url change rule look like? I think I might have a use case for this that would mla few things a lot easier!

jrjdavidson commented 2 years ago

To install a new resource in the place of an existing one, I modified the store using the steps you suggested, as well as just removed the cache under /var/vts/cache and now have my new resource.

Note that I think you might need to restart nginx if you just rm -rf the cache folder like I did.