Open mtravis opened 6 years ago
Hi Matt,
If the script has reached 'Success!' (I'll probably change the text printed at the end for various reasons), then it has at least ran through the script without declaring any immediate errors.
The most common issue I've had when no maps are exported is due to the filter and output names syntax.
I can see that I've incorrectly quoted the syntax for atlasFilter at line 40. . Atlas filter should print in the following format: "Column" = 'Value'
However, for columns and values, the " or ' need escaping using a backslash . When using the argument -F, the 3 arguments following it are concatenated into the above syntax automatically to save trouble! You can either try using the -F flag first, or hard code it as below:
The syntax for the hardcoded value (including a demo of the output) would be :
>>> atlasFilter = '\"Column\" = \'Value\''
>>> print(atlasFilter)
"Column" = 'Value'
>>>
atlasFilter = '\"pc_area\" = \'PL\''
A similar approach is required for outputName. As this is set to \@atlas_featurenumber it shouldn't be a problem. For both of these though, the best advice is the following:
If you still get no results when the syntax is corrected, run the code piece by piece in python to see where it trips up. Avoid any sections with if() relating to flags / overrides and see where the issue lies. If it's with the core code, then I can change that.
Keep me posted!
* As a note, when adding code to an issue / comment, you can use syntax highlighting and display it as a code block as follows: ```python \<your code here> ```
Hi Rob
Thanks for the tips. Made the changes and now getting this error:
C:\Users\matt>C:\OSGeo4W64\bin\python-qgis.bat C:\\temp\\py\\AtlasExport.py
Cannot write to c:temp/py/PL.png. This file may be open in another application.
Cannot write to c:temp/py/PL.png. This file may be open in another application.
Success!
Odd it repeats that line. There is no PL currently in that folder either so not sure why it thinks there is.
It appears then that it doesn't like the format of the output path.
c:temp/py/
is not a valid path, so it may be trying to write to a location that does not exist. It would still be a strange error message if this was the case though.
Instead of outputFolder = 'c:temp\py'
Use outputFolder = 'c:\temp\py'
and see how you get on.
I used outputFolder = 'c:\\temp\\py'
in the end to get it to work.
Wonder why it's different for you? Anyway it's a great tool and I can see myself using it a lot.
Glad you have found some use in it. It's been a fun learning curve getting it set up and 'working'. I don't think it would take too much to modify it to work with qgis 2.18.* if anyone wanted to adapt the code, but I though moving forward it would be best to use this version.
If you're happy with the formatting now, I'll close the issue.
Here's the script I'm using.
Thanks, Matt