Tool for downloading and splitting topo maps across A3 pages

NSW & ACT specific bushwalking discussion.
Forum rules
NSW & ACT specific bushwalking discussion. Please avoid publishing details of access to sensitive areas with no tracks.

Tool for downloading and splitting topo maps across A3 pages

Postby tschanzer » Wed 15 Jan, 2025 11:44 pm

I recently found myself needing a printed NSW Spatial Services topo map, but had neither the time to buy a hard copy nor access to a large-format printer to produce my own. I needed to split the map across several A3 pages for use with a normal printer, but found Adobe Acrobat's poster print option too restrictive.

So I wrote a simple Python-based command-line tool that will, given the name of any 1:25k map (e.g., "katoomba") and publication year (e.g., 2017):
  • Download the corresponding PDF from the NSW Spatial Collaboration Portal
  • Split the map (excluding legend and cover page) across six landscape A3 pages with 20mm overlaps
  • Put the legend and cover page side-by-side on a separate portrait A3 page

For example, the command
Code: Select all
python -m nsw_topo_split katoomba 2022
produces (in 1.5s on my cheap laptop) pages that look like this:
example.png


The source code, installation instructions and more detailed documentation can be found at https://github.com/tschanzer/nsw-topo-split; you are free to use, modify and redistribute them under the terms of the MIT license. Any feedback is welcome, but I can't commit to actively maintaining the package.
tschanzer
Nothofagus cunninghamii
Nothofagus cunninghamii
 
Posts: 5
Joined: Wed 20 Nov, 2024 8:15 pm
Region: New South Wales
Gender: Male

Re: Tool for downloading and splitting topo maps across A3 p

Postby Allchin09 » Fri 17 Jan, 2025 10:59 am

Nice work! Thanks for sharing.

I tried it on the Katoomba 2022 per your example and I was surprised to see roads, etc outside of the border/collar but I assumed it was some layer issue with how you'd processed the map. Looked at the original and it's the same though so not your issue

I noticed that all three produced files (original, _cover and _split) are the same size. I wouldn't expect the cover to be 10mb. Split maybe. Just seemed odd.

Also - maybe an option for those with only an A4 printer? Anyway, I'll check out your code :)
Tackling the unknown and the awesome one adventure at a time!

Check out my latest trips at http://aoacblog.wordpress.com/posts
Allchin09
Phyllocladus aspleniifolius
Phyllocladus aspleniifolius
 
Posts: 696
Joined: Fri 27 Apr, 2012 3:24 pm
Location: The Shire
ASSOCIATED ORGANISATIONS: Sydney Bush Walkers
Region: New South Wales
Gender: Male

Re: Tool for downloading and splitting topo maps across A3 p

Postby tschanzer » Fri 17 Jan, 2025 12:51 pm

Thanks for the feedback!
Allchin09 wrote:I noticed that all three produced files (original, _cover and _split) are the same size. I wouldn't expect the cover to be 10mb. Split maybe. Just seemed odd.

This is because PDF cropping (in general, not just in pypdf) works by adjusting the page's media box without affecting the underlying data. If the file size of the cover page is an issue, I can think of two ways to delete the cropped data:
  • Rasterise the document
  • In Adobe Acrobat, "Redact a PDF" > "Sanitize document" > Tick "Deleted or cropped content" and "Overlapping objects"
Allchin09 wrote:Also - maybe an option for those with only an A4 printer? Anyway, I'll check out your code :)

Definitely! The code was a bit of a rush job, so the page size and layout are currently hard-coded, but I can easily include them as command-line options.
tschanzer
Nothofagus cunninghamii
Nothofagus cunninghamii
 
Posts: 5
Joined: Wed 20 Nov, 2024 8:15 pm
Region: New South Wales
Gender: Male

Re: Tool for downloading and splitting topo maps across A3 p

Postby tom_brennan » Tue 21 Jan, 2025 11:25 am

Nice one! Would it be worth adding a bit more side-to-side overlap to make more use of the white space.

Though I should probably just fork the code and create a pull request :lol:
Bushwalking NSW - http://bushwalkingnsw.com
User avatar
tom_brennan
Athrotaxis selaginoides
Athrotaxis selaginoides
 
Posts: 1415
Joined: Wed 29 Sep, 2010 9:21 am
Location: Sydney
Region: New South Wales
Gender: Male

Re: Tool for downloading and splitting topo maps across A3 p

Postby tschanzer » Tue 21 Jan, 2025 8:42 pm

Good idea Tom! The default behaviour is now to automatically increase the horizontal and/or vertical overlaps to eliminate any white space, as shown below. There is a command line flag to disable this.
example.png

Other changes:
  • Added command line options for page size and orientation, number of pages along each axis, and overlap along each axis
  • Output is now sorted into subdirectories by year and map name
  • If the original map already exists, it will not be re-downloaded unless the -f/--force-download flag is given
  • More docstrings and comments

The latest usage instructions are in README.md. Issues and pull requests are most welcome.
tschanzer
Nothofagus cunninghamii
Nothofagus cunninghamii
 
Posts: 5
Joined: Wed 20 Nov, 2024 8:15 pm
Region: New South Wales
Gender: Male

Re: Tool for downloading and splitting topo maps across A3 p

Postby Allchin09 » Fri 24 Jan, 2025 11:49 am

Liking the enhancements :) I've raised two issues on github ;)
Tackling the unknown and the awesome one adventure at a time!

Check out my latest trips at http://aoacblog.wordpress.com/posts
Allchin09
Phyllocladus aspleniifolius
Phyllocladus aspleniifolius
 
Posts: 696
Joined: Fri 27 Apr, 2012 3:24 pm
Location: The Shire
ASSOCIATED ORGANISATIONS: Sydney Bush Walkers
Region: New South Wales
Gender: Male


Return to New South Wales & ACT

Who is online

Users browsing this forum: No registered users and 9 guests