Open pierloca opened 5 years ago
Hi @pierloca, thanks for your comments. The primary issue here is one I haven't yet encountered, mostly because I use proprietary basemaps rather than OSM. I have experienced a few issues when exporting using OSM through atlases in the past (before I'd written this script). It doesn't sound so much that the python element is the problem as much as the atlas exporting with OSM data.
I'll try adding some OSM layers to a few atlas maps and export them to PNG (if this is what you're trying to do?). Can I ask if you're using a WMS service for background mapping, or just the vector layers as described? It should help me replicate the issue and figure out if it's something I can help with.
Concerning your other point, how are you trying to add the output name to the PDFs?
I'm using the flag -Q output_name
on a regular basis to output PDFs with dynamic file names; though I did have trouble with it originally. If you've got an example of the python/cmd you're running I might be able to point you in the right direction.
As a side note, I realise since this was posted I've added several extra flags to the outputs, including one for complex filters (takes some effort to escape quotation marks correctly!) and changing the map theme. I'll make an effort to update the script soon to add these improvements.
Hi Carey, thanks for fast answer! first point, correct, I have a project with layers that comes directly from a postgresql database, some local shapefiles and a basemap OSM ( wms ), but I changed with google and bing with same results, and I'm trying to export the atlas, everything shown except OSM background.
Anyway, thanks a lot, great job, I'm learning a lot studying python files
No worries, I didn't think anyone was really using this script! Concerning the WMS, would you be able to provide the getCapabilities URL for that specific feed? I'll find some time to test it at some point either today or tomorrow to see if I can replicate the error and get it to the bottom of it.
name issue -
I'm beginning to remember now that I couldn't find a solution to passing the PDF name dynamically from the atlas feature. That's why there's a separate flag (-Q) to override this in the script. I've tried passing column names using that as well and always encounter the same error: QPainter::begin(): Return false
. Unfortunately I'm not sure there's a solution I can deal with here. It may be that this issue is rectified with a newer version of QGIS and python, but I've not updated the script to work with that yet. I will be doing that eventually though and will post the changes then.
I wish I could help more, but I'm honestly new to python myself. This is literally the only thing I've written, and it took weeks of getting lost in the QGIS API to even get this far!
I load directly from quickmapservice plugin an OSM standard map, you can use that
I've finally had the chance to try and test some of the OSM related issues with the script / Atlases in general and it's a little inconclusive thus far. I was able to add OSM from the plugin as mentioned, but it exported fine from both the atlas itself and when using the python script.
In this example I was using a project with a native map projection of British National Grid (EPSG:27700), and adding the OSM with map projection WGS 84 / Pseudo-Mercator (EPSG:3857).
Can I ask if your project is based in EPSG:3857 with other layers reprojected (on the fly) to this projection, or whether OSM is being reprojected to your own native projection?
I use linux, so i change variables for my system, script runs well, I have only one (two, actually) problem: in exported atlas files, I get everything from the print composer except the OSM base layout, map is white with only points and poligons from layer, is there any other command to give to show base map? if I export atlas from inside qgis everything is correct. It seems that it has some problem to access dataset ("Unsupported blend ERROR 6: The PNG driver does not support update access to existing datasets"), but OSM tiles are pngs. I'm sorry, maybe it's a low level question, but i'm very new in python and I have not enougt skills to find the solution inside API site. second, less important, I can work-arount on it, I try to give, as for images, the name from the output query in pdf exports but I can't.