[GeoNode-devel] generation of layer's thumbnail with a custom base map (Paolo Corti)

Toni Schönbuchner toni.schoenbuchner at csgis.de
Mon Feb 25 23:34:25 PST 2019


Dear Paolo,

sorry I´ve might have sent you on a wrong track. But I think printing plugin (mapfish) and printng are different extensions.

The one you might be interested in should be:
https://github.com/boundlessgeo/geoserver-exts/tree/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng <https://github.com/boundlessgeo/geoserver-exts/tree/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng>

where you find some docs here:
https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/doc/api.rst <https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/doc/api.rst>

In case of the caching behavior maybe it helps  to dig a bit in code
https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L156 <https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L156>
 
So from what I see caching has nothing to do with GWC but with a base64 string written to cacheDIr:
https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L147 <https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L147>

Where cacheDir is the java.io.tmpdir value.  Which might be just /tmp or /var/tmp on Linux plattforms.
https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintSupport.java#L28 <https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintSupport.java#L28>

My guess is your baselayer is kicked out somewhere here:
https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L92 <https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L92>

Can you double check that your sent html fulfills all requirements like img tags, correct style attribute with
no display: none etc in other words what the if statements expect?

Another thing what could fail is when loading the resource:
https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L78 <https://github.com/boundlessgeo/geoserver-exts/blob/46dc818caf57d2b5ca1d04e8f40926c67b11493f/printng/src/main/java/org/geoserver/printng/PrintUserAgentCallback.java#L78>

Unfortunately I´m not a Java guy at all, so others might definitly know better.


Best regards,

Toni



> Am 26.02.2019 um 00:20 schrieb Paolo Corti <pcorti at gmail.com>:
> 
> Hi Toni
> 
> thanks for helping with this.
> 
> As a first thing, I tried to add the base layers IP in the hosts
> section of config.yaml (with !dnsMatch).
> What is confusing me, looking at the log, is that GeoServer is trying
> to read the tiles from the cache, as it would be a local layer:
> 
> ....
> 2019-02-25 23:16:25,811 DEBUG [geoserver.printng] - using cache for
> http://t4.tianditu.com/DataServer?T=vec_w&X=14&Y=7&L=4&tk=mykey
> 2019-02-25 23:16:25,812 DEBUG [geoserver.printng] - using cache for
> http://t4.tianditu.com/DataServer?T=vec_w&X=14&Y=5&L=4&tk=mykey
> ...
> 
> not sure how to solve this. Maybe I'll ask in the GeoServer list
> best
> Paolo
> 
> On Sat, Feb 23, 2019 at 3:38 PM Toni Schönbuchner
> <toni.schoenbuchner at csgis.de> wrote:
>> 
>> Dear Paolo,
>> 
>> some time ago I´ve been in a similar situation trying to debug thumbnails with leaflet.
>> Unfortuantely I could not find docs for printing execept:
>> 
>> https://docs.geoserver.org/latest/en/user/extensions/printing/index.html
>> https://docs.geoserver.org/stable/en/user/extensions/printing/configuration.html
>> 
>> However what helped me was a to double check that cleaned markup has everything we need:
>> https://github.com/GeoNode/geonode/blob/master/geonode/static/geonode/js/utils/thumbnail.js#L17
>> 
>> I did this by just testing the code in browser console and adding the cloned map to the body.
>> Then to work a bit faster I´ve used https://www.getpostman.com/ to send the generated markup to the printing endpoint.
>> 
>> If I remember correctly I´ve faced an issue with thumbnail.js deleting to much and some SSL mixed
>> content blocking.
>> 
>> Not much, but hopefully a start.
>> 
>> cheers,
>> 
>> Toni
>> 
>> 
>> 
>> Message: 1
>> Date: Fri, 22 Feb 2019 17:35:04 -0500
>> From: Paolo Corti <pcorti at gmail.com>
>> To: geonode-devel <geonode-devel at lists.osgeo.org>
>> Subject: [GeoNode-devel] generation of layer's thumbnail with a custom
>> base map
>> Message-ID:
>> <CAHXrU-KOd-v4aivGgvz3O9c0Sv-qmSmW=4gLT1QKTH5Mgidbfg at mail.gmail.com>
>> Content-Type: text/plain; charset="UTF-8"
>> 
>> Hi GeoNode developers
>> 
>> We have the following problem: in one of our instances we are using
>> some custom basemaps. When using the "Set Thumbnail" feature from
>> layer page using one of this custom base maps, the thumbnail is
>> created but only the layer is rendered, in a white background.
>> Debugging the code, it looks like the thumbnail is generated by
>> sending a post request to geoserver/rest/printng (in the
>> geoserver/helpers.py/_render_thumbnail).
>> Where can I find some documentation about this printng GeoServer endpoint?
>> 
>> Thanks
>> Paolo
>> 
>> --
>> Paolo Corti
>> Geospatial software developer
>> web: http://www.paolocorti.net
>> twitter: @capooti
>> skype: capooti
>> 
>> 
>> ------------------------------
>> 
>> Subject: Digest Footer
>> 
>> _______________________________________________
>> geonode-devel mailing list
>> geonode-devel at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/geonode-devel
>> 
>> 
>> ------------------------------
>> 
>> End of geonode-devel Digest, Vol 49, Issue 22
>> *********************************************
>> 
>> 
> 
> 
> -- 
> Paolo Corti
> Geospatial software developer
> web: http://www.paolocorti.net
> twitter: @capooti
> skype: capooti
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20190226/3d9aa5c1/attachment.html>


More information about the geonode-devel mailing list