Getting tiles for plugin usage

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting tiles for plugin usage

Jiri Vlasak
Dear JOSM devs,

there was Missing Maps hackathon this weekend in Pilsen, Czech Republic. One of
the tasks we were working on was click building feature [1] -- building plot
based on mouse click to the middle of the building.

I am interested in getting background imagery in effective way. Currently, the
following steps are used:
1. Mouse listener knows the coordinates.
2. Coordinates are recomputed to TileXY.
3. New tiles around the mouse click are created in array (9 of them).
4. Based on Tile URL, Images are downloaded and used for algorithm.

I feel like downloading Tiles multiple times is not effective.

Also, I think that we found a bug in Tile.getUrl() -- for Esri imagery, it
returns:

https://{switch:services,server}.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}/17/79468/63554.png

Instead of proper URL. And I have the same issues with Maxar.

[1]: https://gitlab.com/qeef/mapathoner/commits/feature/click-building

Thanks,
jiri

Reply | Threaded
Open this post in threaded view
|

Re: Getting tiles for plugin usage

Dirk Stöcker
On Thu, 17 Oct 2019, Jiri Vlasak wrote:

> there was Missing Maps hackathon this weekend in Pilsen, Czech Republic. One of
> the tasks we were working on was click building feature [1] -- building plot
> based on mouse click to the middle of the building.
>
> I am interested in getting background imagery in effective way. Currently, the
> following steps are used:
> 1. Mouse listener knows the coordinates.
> 2. Coordinates are recomputed to TileXY.
> 3. New tiles around the mouse click are created in array (9 of them).
> 4. Based on Tile URL, Images are downloaded and used for algorithm.
>
> I feel like downloading Tiles multiple times is not effective.

I'd recommend the meachnism already included in JOSM, e.g. the Tile loader
classes which also do caching.

> Also, I think that we found a bug in Tile.getUrl() -- for Esri imagery, it
> returns:
>
> https://{switch:services,server}.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer/tile/{zoom}/{y}/{x}/17/79468/63554.png
>
> Instead of proper URL. And I have the same issues with Maxar.

Seems you use a templated tile url in a non-templated environment:

See here for a description of the templated format:
https://josm.openstreetmap.de/wiki/Maps#TileMapServicesTMS

Ciao
--
http://www.dstoecker.eu/ (PGP key available)

Reply | Threaded
Open this post in threaded view
|

Re: Getting tiles for plugin usage

Jiri Vlasak
On Sun, Oct 20, 2019 at 12:54:40PM +0200, Dirk Stöcker wrote:

> On Thu, 17 Oct 2019, Jiri Vlasak wrote:
>
> > there was Missing Maps hackathon this weekend in Pilsen, Czech Republic. One of
> > the tasks we were working on was click building feature [1] -- building plot
> > based on mouse click to the middle of the building.
> >
> > I am interested in getting background imagery in effective way. Currently, the
> > following steps are used:
> > 1. Mouse listener knows the coordinates.
> > 2. Coordinates are recomputed to TileXY.
> > 3. New tiles around the mouse click are created in array (9 of them).
> > 4. Based on Tile URL, Images are downloaded and used for algorithm.
> >
> > I feel like downloading Tiles multiple times is not effective.
>
> I'd recommend the meachnism already included in JOSM, e.g. the Tile loader
> classes which also do caching.

That's good point. I would like to use that, but I am lost in how does it work.
Can you point me to the right direction, please?

I feel like I miss something basic. I am able to get the current ImageryLayer
but not the image. And the methods I think could work for me (like
`getVisibleTileSet()`) are usually private.

Thanks,
jiri