[MapProxy] Return png8 layers

Just van den Broecke just at justobjects.nl
Fri Jun 29 04:18:21 PDT 2018


Hi Andrzej,

I use png8 as well, but a slightly different config under "globals":

   image:
     # resampling_method: nearest
     resampling_method: bilinear
     paletted: true
     formats:
       png8:
         format: image/png
         colors: 256

Note: you use format: image/png8...

Best,

Just

On 29-06-18 12:23, Andrzej Kępys wrote:
> Hi All.
> 
> I Have a little problem with configuration - any help appreciated.
> 
> I have to replace my existing web map servers with something else - so I 
> choose mapproxy and I'm very pleased of it's efficiency and simplicity - 
> it's working perfect, but... trouble is that new servers have to work 
> exactly the same as an old ones - have to provide the same layers, with 
> the same names, formats and other properties, because I have about 500 
> fat-client applications and I need to avoid replacing them all.
> 
> As for now lots of work is done - I made mapnik backend (source, cache) 
> in local srs for Poland (2180) and I'm serving them with wms tiled - 
> everything work, but last thing I have to do is to serve layers in 
> format 'image/png8' because all applications expects this format. I 
> found few snippets on the web, but no luck as for now... I have 
> 'image/png8' in overall wms properties, but I need them in tilesets 
> properties also...
> 
> My config and capabilities document below - any help appreciated
> 
>> # -------------------------------
>> # MapProxy example configuration.
>> # -------------------------------
>> #
>> # This is a minimal MapProxy configuration.
>> # See full_example.yaml and the documentation for more options.
>> #
>>
>> # Starts the following services:
>> # Demo:
>> #     http://localhost:8080/demo
>> # WMS:
>> #     capabilities: http://localhost:8080/service?REQUEST=GetCapabilities
>> # WMTS:
>> #     capabilities: http://localhost:8080/wmts/1.0.0/WMTSCapabilities.xml
>> #     first tile: http://localhost:8080/wmts/osm/webmercator/0/0/0.png
>> # Tile service (compatible with OSM/etc.)
>> #     first tile: http://localhost:8080/tiles/osm/webmercator/0/0/0.png
>> # TMS:
>> #     note: TMS is not compatible with OSM/Google Maps/etc.
>> #     fist tile: 
>> http://localhost:8080/tms/1.0.0/osm/webmercator/0/0/0.png
>> # KML:
>> #     initial doc: http://localhost:8080/kml/osm/webmercator
>>
>> services:
>>   demo:
>>   tms:
>>     use_grid_names: true
>>     # origin for /tiles service
>>     origin: 'nw'
>>   kml:
>>       use_grid_names: true
>>   wmts:
>>   wms:
>>     srs: ['EPSG:4326', 'EPSG:900913', 'EPSG:3857', 'EPSG:2180']
>>     image_formats: ['image/png', png8]
>>     md:
>>       title: MapProxy WMS Proxy
>>       abstract: This is a minimal MapProxy example.
>>
>> layers:
>>   - name: "osm:Mapa_active"
>>     title: Mapa podstawowa
>>     sources: [m_base_cache]
>>     image_formats: ['image/png', png8]
>>   - name: "osm:Hydranty_active"
>>     title: Mapa podstawowa
>>     sources: [m_emergency_cache]
>>     image_formats: ['image/png', png8]
>>   - name: "osm:Rejony_operacyjne_active"
>>     title: Mapa podstawowa
>>     sources: [m_regions_cache]
>>     image_formats: ['image/png', png8]
>>
>> caches:
>>   m_base_cache:
>>     grids: [puwg]
>>     sources: [mapnik_base]
>>     image_formats: ['image/png', png8, 'image/tiff']
>>   m_emergency_cache:
>>     grids: [puwg]
>>     sources: [mapnik_emergency]
>>     image_formats: ['image/png', png8]
>>   m_regions_cache:
>>     grids: [puwg]
>>     sources: [mapnik_regions]
>>     image_formats: ['image/png', png8]
>>
>> sources:
>>   mapnik_base:
>>     type: mapnik
>>     mapfile: /srv/mapnik_2180/base_2180.xml
>>     image_formats: ['image/png', png8]
>>   mapnik_emergency:
>>     type: mapnik
>>     mapfile: /srv/mapnik_2180/emergency_2180.xml
>>     transparent: True
>>     image_formats: ['image/png', png8]
>>   mapnik_regions:
>>     type: mapnik
>>     mapfile: /srv/mapnik_2180/regions_2180.xml
>>     transparent: True
>>     image_formats: ['image/png', png8]
>>
>>
>> grids:
>>     webmercator:
>>         base: GLOBAL_WEBMERCATOR
>>     puwg:
>>         srs: EPSG:2180
>>         bbox: [144907.16581514146, 129171.69217334315, 
>> 926415.1553865769, 910679.6817447785]
>>         bbox_srs: EPSG:2180
>>         res: [3052.7655842634194, 1526.3827921317097, 
>> 763.1913960658549, 381.59569803292743, 190.79784901646372, 
>> 95.39892450823186, 47.69946225411593, 23.849731127057964, 
>> 11.924865563528982, 5.962432781764491, 2.9812163908822455, 1.49060
>>
>>
>>
>> globals:
>>   image:
>>     # resampling: 'bicubic'
>>     paletted: true
>>     formats:
>>       custom:
>>         format: image/jpeg
>>       png8:
>>         format: image/png8
>>         colors: 256
> --------------------------
> 
>> <?xml version="1.0"?>
>> <!DOCTYPE WMT_MS_Capabilities SYSTEM 
>> "http://schemas.opengis.net/wms/1.1.1/WMS_MS_Capabilities.dtd"
>>  [
>>  <!ELEMENT VendorSpecificCapabilities (TileSet*) >
>>  <!ELEMENT TileSet (SRS, BoundingBox?, Resolutions, Width, Height, 
>> Format, Layers*, Styles*) >
>>  <!ELEMENT Resolutions (#PCDATA) >
>>  <!ELEMENT Width (#PCDATA) >
>>  <!ELEMENT Height (#PCDATA) >
>>  <!ELEMENT Layers (#PCDATA) >
>>  <!ELEMENT Styles (#PCDATA) >
>>  ]>  <!-- end of DOCTYPE declaration -->
>> <WMT_MS_Capabilities version="1.1.1">
>> <Service>
>>   <Name>OGC:WMS</Name>
>>   <Title>MapProxy WMS Proxy</Title>
>>   <Abstract>This is a minimal MapProxy example.</Abstract>
>>   <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" 
>> xlink:href="http://mapabkp.abakus.net.pl:8090/service"/>
>>   <Fees>none</Fees>
>>   <AccessConstraints>none</AccessConstraints>
>> </Service>
>> <Capability>
>>   <Request>
>>     <GetCapabilities>
>>       <Format>application/vnd.ogc.wms_xml</Format>
>>       <DCPType>
>>         <HTTP>
>>           <Get><OnlineResource 
>> xmlns:xlink="http://www.w3.org/1999/xlink" 
>> xlink:href="http://mapabkp.abakus.net.pl:8090/service?"/></Get>
>>         </HTTP>
>>       </DCPType>
>>     </GetCapabilities>
>>     <GetMap>
>>         <Format>image/png</Format>
>>         <Format>image/png8</Format>
>>       <DCPType>
>>         <HTTP>
>>           <Get><OnlineResource 
>> xmlns:xlink="http://www.w3.org/1999/xlink" 
>> xlink:href="http://mapabkp.abakus.net.pl:8090/service?"/></Get>
>>         </HTTP>
>>       </DCPType>
>>     </GetMap>
>>     <GetFeatureInfo>
>>       <Format>text/plain</Format>
>>       <Format>text/html</Format>
>>       <Format>application/vnd.ogc.gml</Format>
>>       <DCPType>
>>         <HTTP>
>>           <Get><OnlineResource 
>> xmlns:xlink="http://www.w3.org/1999/xlink" 
>> xlink:href="http://mapabkp.abakus.net.pl:8090/service?"/></Get>
>>         </HTTP>
>>       </DCPType>
>>     </GetFeatureInfo>
>>   </Request>
>>   <Exception>
>>     <Format>application/vnd.ogc.se_xml</Format>
>>     <Format>application/vnd.ogc.se_inimage</Format>
>>     <Format>application/vnd.ogc.se_blank</Format>
>>   </Exception>
>>   <VendorSpecificCapabilities>
>>     <TileSet>
>>       <SRS>EPSG:2180</SRS>
>>       <BoundingBox SRS="EPSG:2180" minx="144907.165815" 
>> miny="129171.692173" maxx="926415.155387" maxy="910679.681745" />
>>       <Resolutions>3052.76558426 1526.38279213 763.191396066 
>> 381.595698033 190.797849016 95.3989245082 47.6994622541 23.8497311271 
>> 11.9248655635 5.96243278176 2.98121639088 1.49060819544 0.745304097721 
>> 0.37265204886 </Resolutions>
>>       <Width>256</Width>
>>       <Height>256</Height>
>>       <Format>image/png</Format>
>>       <Layers>osm:Mapa_active</Layers>
>>       <Styles></Styles>
>>     </TileSet>
>>     <TileSet>
>>       <SRS>EPSG:2180</SRS>
>>       <BoundingBox SRS="EPSG:2180" minx="144907.165815" 
>> miny="129171.692173" maxx="926415.155387" maxy="910679.681745" />
>>       <Resolutions>3052.76558426 1526.38279213 763.191396066 
>> 381.595698033 190.797849016 95.3989245082 47.6994622541 23.8497311271 
>> 11.9248655635 5.96243278176 2.98121639088 1.49060819544 0.745304097721 
>> 0.37265204886 </Resolutions>
>>       <Width>256</Width>
>>       <Height>256</Height>
>>       <Format>image/png</Format>
>>       <Layers>osm:Hydranty_active</Layers>
>>       <Styles></Styles>
>>     </TileSet>
>>     <TileSet>
>>       <SRS>EPSG:2180</SRS>
>>       <BoundingBox SRS="EPSG:2180" minx="144907.165815" 
>> miny="129171.692173" maxx="926415.155387" maxy="910679.681745" />
>>       <Resolutions>3052.76558426 1526.38279213 763.191396066 
>> 381.595698033 190.797849016 95.3989245082 47.6994622541 23.8497311271 
>> 11.9248655635 5.96243278176 2.98121639088 1.49060819544 0.745304097721 
>> 0.37265204886 </Resolutions>
>>       <Width>256</Width>
>>       <Height>256</Height>
>>       <Format>image/png</Format>
>>       <Layers>osm:Rejony_operacyjne_active</Layers>
>>       <Styles></Styles>
>>     </TileSet>
>>   </VendorSpecificCapabilities>
>>   <Layer>
>>     <Title>MapProxy WMS Proxy</Title>
>>     <SRS>EPSG:4326</SRS>
>>     <SRS>EPSG:900913</SRS>
>>     <SRS>EPSG:3857</SRS>
>>     <SRS>EPSG:2180</SRS>
>>     <LatLonBoundingBox minx="13.3120344438" miny="48.8830586734" 
>> maxx="25.8220848921" maxy="56.0567547244" />
>>     <BoundingBox SRS="EPSG:900913" minx="1481888.89571" 
>> miny="6255042.14171" maxx="2874501.34141" maxy="7569722.22253" />
>>     <BoundingBox SRS="EPSG:4326" minx="13.3120344438" 
>> miny="48.8830586734" maxx="25.8220848921" maxy="56.0567547244" />
>>     <BoundingBox SRS="EPSG:3857" minx="1481888.89571" 
>> miny="6255042.14171" maxx="2874501.34141" maxy="7569722.22253" />
>>     <Layer>
>>       <Name>osm:Mapa_active</Name>
>>       <Title>Mapa podstawowa</Title>
>>       <LatLonBoundingBox minx="13.3120344438" miny="48.8830586734" 
>> maxx="25.8220848921" maxy="56.0567547244" />
>>       <BoundingBox SRS="EPSG:900913" minx="1481888.89571" 
>> miny="6255042.14155" maxx="2874501.34141" maxy="7569722.22236" />
>>       <BoundingBox SRS="EPSG:4326" minx="13.3120344438" 
>> miny="48.8830586734" maxx="25.8220848921" maxy="56.0567547244" />
>>       <BoundingBox SRS="EPSG:3857" minx="1481888.89571" 
>> miny="6255042.14155" maxx="2874501.34141" maxy="7569722.22236" />
>>       <BoundingBox SRS="EPSG:2180" minx="144907.165815" 
>> miny="129171.692173" maxx="926415.155387" maxy="910679.681745" />
>>     </Layer>
>>     <Layer>
>>       <Name>osm:Hydranty_active</Name>
>>       <Title>Mapa podstawowa</Title>
>>       <LatLonBoundingBox minx="13.3120344438" miny="48.8830586734" 
>> maxx="25.8220848921" maxy="56.0567547244" />
>>       <BoundingBox SRS="EPSG:900913" minx="1481888.89571" 
>> miny="6255042.14155" maxx="2874501.34141" maxy="7569722.22236" />
>>       <BoundingBox SRS="EPSG:4326" minx="13.3120344438" 
>> miny="48.8830586734" maxx="25.8220848921" maxy="56.0567547244" />
>>       <BoundingBox SRS="EPSG:3857" minx="1481888.89571" 
>> miny="6255042.14155" maxx="2874501.34141" maxy="7569722.22236" />
>>       <BoundingBox SRS="EPSG:2180" minx="144907.165815" 
>> miny="129171.692173" maxx="926415.155387" maxy="910679.681745" />
>>     </Layer>
>>     <Layer>
>>       <Name>osm:Rejony_operacyjne_active</Name>
>>       <Title>Mapa podstawowa</Title>
>>       <LatLonBoundingBox minx="13.3120344438" miny="48.8830586734" 
>> maxx="25.8220848921" maxy="56.0567547244" />
>>       <BoundingBox SRS="EPSG:900913" minx="1481888.89571" 
>> miny="6255042.14155" maxx="2874501.34141" maxy="7569722.22236" />
>>       <BoundingBox SRS="EPSG:4326" minx="13.3120344438" 
>> miny="48.8830586734" maxx="25.8220848921" maxy="56.0567547244" />
>>       <BoundingBox SRS="EPSG:3857" minx="1481888.89571" 
>> miny="6255042.14155" maxx="2874501.34141" maxy="7569722.22236" />
>>       <BoundingBox SRS="EPSG:2180" minx="144907.165815" 
>> miny="129171.692173" maxx="926415.155387" maxy="910679.681745" />
>>     </Layer>
>>   </Layer>
>> </Capability>
>> </WMT_MS_Capabilities>
> 
> 
> 
> 
> 
> 


More information about the MapProxy mailing list