Discussion:
[MapProxy] MapProxy serving gdal2tiles output
Angelos Tzotsos
2012-11-28 20:31:06 UTC
Permalink
Hi,

I have a simple tif image in EPSG:2100 that I want to serve through a
TMS and WMS.
I have created tiles using gdal2tiles and I want to use MapProxy to
provide the above services, without using another server.
Is this possible?

What I am doing is defining a cache without a source, giving the
directory where the tile structure is located.
I followed the documentation and some information I got asking on IRC
and this is my yaml file so far:
http://pastebin.com/wAkM4G2d

Unfortunately, I get a blank tile when I ask for 0/0/0.png from my web
browser under TMS service.
I have seen that there is a seed_only option, but for wms sources, I do
not know if this is possible for a cache.
Any hints?

Thanks,
Angelos
--
Angelos Tzotsos
Remote Sensing Laboratory
National Technical University of Athens
http://users.ntua.gr/tzotsos
Oliver Tonnhofer
2012-11-28 21:17:04 UTC
Permalink
I have a simple tif image in EPSG:2100 that I want to serve through a TMS and WMS.
I have created tiles using gdal2tiles and I want to use MapProxy to provide the above services, without using another server.
Is this possible?
Yes :)
What I am doing is defining a cache without a source, giving the directory where the tile structure is located.
http://pastebin.com/wAkM4G2d
This looks good. The tricky part will be to configure the right grid of your tiles. I don't know how gdal2tiles works for non-4326/3875 images. Does gdal2tiles give you some information (resolutions, bbox)?
I would remove min_res and add all resolutions that are tiled.
Unfortunately, I get a blank tile when I ask for 0/0/0.png from my web browser under TMS service.
I have seen that there is a seed_only option, but for wms sources, I do not know if this is possible for a cache.
Any hints?
Ignore seed_only, an empty sources list for the cache is enough.
--
Oliver Tonnhofer | Omniscale GmbH & Co KG | http://omniscale.de
http://mapproxy.org | https://github.com/olt | @oltonn
Paul Norman
2012-11-28 21:32:24 UTC
Permalink
From: mapproxy-bounces at lists.osgeo.org [mailto:mapproxy-
Subject: Re: [MapProxy] MapProxy serving gdal2tiles output
Post by Angelos Tzotsos
What I am doing is defining a cache without a source, giving the
directory where the tile structure is located.
Post by Angelos Tzotsos
I followed the documentation and some information I got asking on IRC
http://pastebin.com/wAkM4G2d
This looks good. The tricky part will be to configure the right grid of
your tiles. I don't know how gdal2tiles works for non-4326/3875 images.
Does gdal2tiles give you some information (resolutions, bbox)?
I would remove min_res and add all resolutions that are tiled.
By default gdal2tiles uses the OGC TMS spec instead of the Google/OSM one.
It's fairly trivial to convert between these with a shell script.

I have a source which is gdal2tiles generated and what I did was copy up to
z18 to my remote server and then have it fetching z19 and z20 from my home
server. The grid definition I used is

z20:
# About 100mm/px in Vancouver
base: GLOBAL_MERCATOR
origin: ul
num_levels: 21

The relevant cache and source are

surrey2011_cache:
grids: [z20]
sources: [merry_surrey2011_tms]
format: image/png
cache:
type: file
directory_layout: tms

merry_surrey2011_tms:
type: tile
url: Loading Image...
grid: z20
transparent: true
coverage:
polygons: 'wkt/surrey2011.wkt'
polygons_srs: 'EPSG:4326'

I believe all you'd have to do to use the OCG TMS numbering is change the
origin.
Angelos Tzotsos
2012-11-28 23:23:32 UTC
Permalink
Hi,
Post by Paul Norman
From: mapproxy-bounces at lists.osgeo.org [mailto:mapproxy-
Subject: Re: [MapProxy] MapProxy serving gdal2tiles output
Post by Angelos Tzotsos
What I am doing is defining a cache without a source, giving the
directory where the tile structure is located.
Post by Angelos Tzotsos
I followed the documentation and some information I got asking on IRC
http://pastebin.com/wAkM4G2d
This looks good. The tricky part will be to configure the right grid of
your tiles. I don't know how gdal2tiles works for non-4326/3875 images.
Does gdal2tiles give you some information (resolutions, bbox)?
I would remove min_res and add all resolutions that are tiled.
By default gdal2tiles uses the OGC TMS spec instead of the Google/OSM one.
It's fairly trivial to convert between these with a shell script.
Yes I have used the default setting in gdal2tiles.
Post by Paul Norman
I have a source which is gdal2tiles generated and what I did was copy up to
z18 to my remote server and then have it fetching z19 and z20 from my home
server. The grid definition I used is
# About 100mm/px in Vancouver
base: GLOBAL_MERCATOR
origin: ul
num_levels: 21
The relevant cache and source are
grids: [z20]
sources: [merry_surrey2011_tms]
format: image/png
type: file
directory_layout: tms
type: tile
url: http://home.server.name/tiles/Surrey2011/%(tms_path)s.png
grid: z20
transparent: true
polygons: 'wkt/surrey2011.wkt'
polygons_srs: 'EPSG:4326'
So you use a TMS from home and you recreate the cache to the remote server.
This way the tiles are duplicated, right?
Post by Paul Norman
I believe all you'd have to do to use the OCG TMS numbering is change the
origin.
I have changed the origin to both 'nw' and 'sw' with no result. There
must be something wrong going on with EPSG:2100...
--
Angelos Tzotsos
Remote Sensing Laboratory
National Technical University of Athens
http://users.ntua.gr/tzotsos
Angelos Tzotsos
2012-11-28 23:07:47 UTC
Permalink
Post by Oliver Tonnhofer
I have a simple tif image in EPSG:2100 that I want to serve through a TMS and WMS.
I have created tiles using gdal2tiles and I want to use MapProxy to provide the above services, without using another server.
Is this possible?
Yes :)
Great :)
Post by Oliver Tonnhofer
What I am doing is defining a cache without a source, giving the directory where the tile structure is located.
http://pastebin.com/wAkM4G2d
This looks good. The tricky part will be to configure the right grid of your tiles. I don't know how gdal2tiles works for non-4326/3875 images. Does gdal2tiles give you some information (resolutions, bbox)?
I would remove min_res and add all resolutions that are tiled.
This is the tilemapresource file:

<?xml version="1.0" encoding="utf-8"?>
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
<Title>0462042000.tif</Title>
<Abstract></Abstract>
<SRS>EPSG:2100</SRS>
<BoundingBox minx="4200000.00000000000000"
miny="462000.00000000000000" maxx="4201500.00000000000000"
maxy="464000.00000000000000"/>
<Origin x="4200000.00000000000000" y="462000.00000000000000"/>
<TileFormat width="256" height="256" mime-type="image/png"
extension="png"/>
<TileSets profile="raster">
<TileSet href="0" units-per-pixel="8.00000000000000" order="0"/>
<TileSet href="1" units-per-pixel="4.00000000000000" order="1"/>
<TileSet href="2" units-per-pixel="2.00000000000000" order="2"/>
<TileSet href="3" units-per-pixel="1.00000000000000" order="3"/>
<TileSet href="4" units-per-pixel="0.50000000000000" order="4"/>
<TileSet href="5" units-per-pixel="0.25000000000000" order="5"/>
</TileSets>
</TileMap>


I have modified the grid like this:

grid_2100:
tile_size: [256, 256]
srs: 'EPSG:2100'
bbox: [462000.0, 4200000.0, 464000.0, 4201500.0]
bbox_srs: 'EPSG:2100'
origin: 'ul'
res: [8.0, 4.0, 2.0, 1.0, 0.5, 0.25]

Still I get a blanc tile when hitting:
Loading Image...
Post by Oliver Tonnhofer
Unfortunately, I get a blank tile when I ask for 0/0/0.png from my web browser under TMS service.
I have seen that there is a seed_only option, but for wms sources, I do not know if this is possible for a cache.
Any hints?
Ignore seed_only, an empty sources list for the cache is enough.
ok.
--
Angelos Tzotsos
Remote Sensing Laboratory
National Technical University of Athens
http://users.ntua.gr/tzotsos
Angelos Tzotsos
2012-11-28 23:46:25 UTC
Permalink
Post by Angelos Tzotsos
Post by Oliver Tonnhofer
I have a simple tif image in EPSG:2100 that I want to serve through a TMS and WMS.
I have created tiles using gdal2tiles and I want to use MapProxy to
provide the above services, without using another server.
Is this possible?
Yes :)
Great :)
Post by Oliver Tonnhofer
What I am doing is defining a cache without a source, giving the
directory where the tile structure is located.
I followed the documentation and some information I got asking on
http://pastebin.com/wAkM4G2d
This looks good. The tricky part will be to configure the right grid
of your tiles. I don't know how gdal2tiles works for non-4326/3875
images. Does gdal2tiles give you some information (resolutions, bbox)?
I would remove min_res and add all resolutions that are tiled.
<?xml version="1.0" encoding="utf-8"?>
<TileMap version="1.0.0" tilemapservice="http://tms.osgeo.org/1.0.0">
<Title>0462042000.tif</Title>
<Abstract></Abstract>
<SRS>EPSG:2100</SRS>
<BoundingBox minx="4200000.00000000000000"
miny="462000.00000000000000" maxx="4201500.00000000000000"
maxy="464000.00000000000000"/>
<Origin x="4200000.00000000000000" y="462000.00000000000000"/>
<TileFormat width="256" height="256" mime-type="image/png"
extension="png"/>
<TileSets profile="raster">
<TileSet href="0" units-per-pixel="8.00000000000000" order="0"/>
<TileSet href="1" units-per-pixel="4.00000000000000" order="1"/>
<TileSet href="2" units-per-pixel="2.00000000000000" order="2"/>
<TileSet href="3" units-per-pixel="1.00000000000000" order="3"/>
<TileSet href="4" units-per-pixel="0.50000000000000" order="4"/>
<TileSet href="5" units-per-pixel="0.25000000000000" order="5"/>
</TileSets>
</TileMap>
tile_size: [256, 256]
srs: 'EPSG:2100'
bbox: [462000.0, 4200000.0, 464000.0, 4201500.0]
bbox_srs: 'EPSG:2100'
origin: 'ul'
res: [8.0, 4.0, 2.0, 1.0, 0.5, 0.25]
http://127.0.0.1:8080/tms/1.0.0/olp_tms/EPSG2100/0/0/0.png
Post by Oliver Tonnhofer
Unfortunately, I get a blank tile when I ask for 0/0/0.png from my
web browser under TMS service.
I have seen that there is a seed_only option, but for wms sources, I
do not know if this is possible for a cache.
Any hints?
Ignore seed_only, an empty sources list for the cache is enough.
ok.
I just managed to get it working:

I removed the line:

cache_dir: './cache_data/olp_cache_EPSG2100'

from the cache and I removed the previous cache block that was there by
default:

osm_cache:
grids: [GLOBAL_MERCATOR, global_geodetic_sqrt2]
sources: [osm_wms]

Very strange...

Thanks Olivier and Paul for your help :)

Cheers,
Angelos
--
Angelos Tzotsos
Remote Sensing Laboratory
National Technical University of Athens
http://users.ntua.gr/tzotsos
Oliver Tonnhofer
2012-11-30 11:11:10 UTC
Permalink
Post by Angelos Tzotsos
cache_dir: './cache_data/olp_cache_EPSG2100'
Sorry, I overlooked that line.

MapProxy adds `olp_cache_EPSG2100` on its own when you use cache_dir.

MapProxy 1.5.0 will contain a directory option that will work as expected:
http://mapproxy.org/docs/nightly/caches.html#file

I also tried to clarify the cache_dir option:
http://mapproxy.org/docs/nightly/configuration.html#cache-dir


Regards,
Oliver
--
Oliver Tonnhofer | Omniscale GmbH & Co KG | http://omniscale.de
http://mapproxy.org | https://github.com/olt | @oltonn
Angelos Tzotsos
2012-11-30 17:46:00 UTC
Permalink
Post by Oliver Tonnhofer
Post by Angelos Tzotsos
cache_dir: './cache_data/olp_cache_EPSG2100'
Sorry, I overlooked that line.
MapProxy adds `olp_cache_EPSG2100` on its own when you use cache_dir.
http://mapproxy.org/docs/nightly/caches.html#file
http://mapproxy.org/docs/nightly/configuration.html#cache-dir
Regards,
Oliver
Thanks Oliver for the clarification.

Best,
Angelos
--
Angelos Tzotsos
Remote Sensing Laboratory
National Technical University of Athens
http://users.ntua.gr/tzotsos
Loading...