[MapProxy] Chance the cache using a dpi parameter from the request

Matt Walker walkermatt at longwayaround.org.uk
Sat Sep 30 12:31:02 PDT 2017


Hi Andrea,

I've just posted this gist which demonstrates the approach I've used to
manipulate the querystring before calling MapProxy:
https://gist.github.com/walkermatt/970a1520dd4c507db57cd9c2b09b55d7

Hope it helps,

Matt.

On 29 September 2017 at 11:42, Andrea Peri <aperi2007 at gmail.com> wrote:

> Hi Matt,
>
> I try to develope a simply wsgi filter following the suggests of mapproxy
> doc,
>
> But It don't seem to work as I hope.
> Infact the wsgi filter is executed after the request has reached the
> mapproxy, so seem to be late for ac action to change the layersname.
>
> In the config infact the order of execution is:
>
> application = make_wsgi_app(r'/....//mapproxy.yaml')
> application = FilterTochangeLayerName(application,....)
>
> So before the mapproxy do its actions on the original layer and only
> after the filter is able to change the layername, but is too late.
>
> I try to understand if was possible to invert the two rows.
> Before the filter and after the make_wsgi_app.
>
> But it seem not possible.
>
> I wrong something ?
>
> Thx,
> A.
>
>
> 2017-09-25 12:24 GMT+02:00 Matt Walker <walkermatt at longwayaround.org.uk>:
> > Hi Andrea,
> >
> > We do something similar using a WSGI filter in front of MapProxy. In the
> > filter we look for DPI parameter and update the LAYERS query string
> > parameter to the appropriate layer based on it. Details of creating a
> WSGI
> > filter for MapProxy can be found here:
> > https://mapproxy.org/docs/1.10.0/auth.html. Our logic DPI logic is
> within
> > the __call__ method.
> >
> > Hope that helps,
> >
> > Matt.
> >
> > On 22 September 2017 at 12:41, Andrea Peri <aperi2007 at gmail.com> wrote:
> >>
> >> Hi,
> >>
> >> I need to change the resolution of the map returned following the dpi
> >> parameter from the request of the gis client.
> >> To do this, I try to find a solution to use a different cache folder for
> >> the same layer when the dpi from the request are different.
> >>
> >> I try to have 2 kind of cache. One for 90 dpi and another for 300dpi.
> >> The layer should take from the 90 when the user do not put the dpi param
> >> or set explicitly the dpi=90.
> >> Otherwise the layer use the 300 dpi cache when the user request ask foto
> >> dpi=300.
> >>
> >> Is this allowed with mapproxy ?
> >>
> >> Manu THX.
> >> Andrea Peri
> >>
> >>
> >>
> >> _______________________________________________
> >> MapProxy mailing list
> >> MapProxy at lists.osgeo.org
> >> https://lists.osgeo.org/mailman/listinfo/mapproxy
> >
> >
> >
> >
> > --
> > Matt Walker
> > @_walkermatt
>
>
>
> --
> -----------------
> Andrea Peri
> . . . . . . . . .
> qwerty àèìòù
> -----------------
>



-- 
Matt Walker
@_walkermatt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapproxy/attachments/20170930/d1042ee9/attachment.html>


More information about the MapProxy mailing list