Generating map books

JamesRutterJamesRutter Global Mapper UserPosts: 98Trusted User
edited August 2012 in Technical Support
Just wondering if there is a way to utilise GM scripting tools to generate map books. I have a dataset with around 100 polygons and want to generate a PDF map for each polygon in the dataset. Obviously doing this by hand is very tedious and was looking for some hints on whether / how this could be achieved in GM.

Cheers

James

Comments

  • JamesRutterJamesRutter Global Mapper User Posts: 98Trusted User
    edited August 2012
    ...Just realised this post should have been in the scripting forum!

    I'm trying something rudimentary like the following code to achieve an outcome..to load a GM workspace...get a shapefile to use as the polygon crop layer...export a PDF map for each polygon in the dataset. At the moment the script is doing nothing at all as far as I can see?? Also, I can't work out the export file naming business?? How do you use POLYGON_CROP_NAME_ATTR along with FILENAME??

    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    REQUIRE_WORKSPACE="C:\Map_Data\Test_Bookplot_workspace.gmw"
    EXPORT_PDF POLYGON_CROP_FILE="C:\Map_Data\test_bookplot_shapes.shp" POLYGON_CROP_USE_EACH POLYGON_CROP_BBOX_ONLY=YES POLYGON_CROP_NAME_ATTR="Ident" DPI=300 PDF_PAGE_SIZE=A4 PDF_PAGE_ORIENTATION=LANDSCAPE PDF_FILL_PAGE=YES FILENAME="c:\Map_Data\Map_Book.pdf"
  • JamesRutterJamesRutter Global Mapper User Posts: 98Trusted User
    edited August 2012
    Got my script working now...but only from within GM...I can't see any way of getting the script to 'load' a workspace with GM closed. I created buffers around the polygons I wanted to map to 'pad' out the features so they were not right up to the edge of the exported map window. It seems a shame there's no scripting support for buffer generation as this has to be done manually. I exported the buffers to a gmp file and used that as my polygon crop file in the script. I used FILENAME=.pdf along with POLYGON_CROP_NAME_ATTR="Ident" to generate the file names but still not quite sure how to control this properly...could do with a few scripting examples on how to generate file names...even less sure how to generate a folder...or indeed to specify a path to put the files?

    Other than that this appears to be the bones of a script to generate 'map books' in GM. Knowing the huge range of export functionality in GM already it would be quite nice to see a seperate comprehensive dialogue for map_book / atlas generation...taking the best bits from other (quite flakey) plug-ins for other software to create a robust solution.


    GLOBAL_MAPPER_SCRIPT VERSION=1.00
    EXPORT_PDF POLYGON_CROP_FILE="C:\Map_Data\test_bookplot_shapes.gmp" POLYGON_CROP_USE_EACH POLYGON_CROP_BBOX_ONLY=YES POLYGON_CROP_NAME_ATTR="Ident" DPI=300 PDF_PAGE_SIZE=A4 PDF_MARGINS="0.5,0.5,0.5,0.5" PDF_PAGE_ORIENTATION=LANDSCAPE PDF_FILL_PAGE=YES FILENAME=.pdf
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2012
    You can load a workspace in the script using the EMBED_SCRIPT command since a workspace is a script file itself. For the FILENAME parameter, just use the full path you want for the PDF files, like FILENAME="c:\map_test\map_book_output\.pdf". The "Ident" field will be used to fill in the filename of the .pdf.

    Also note if you want to do this in the user interface, just select all of the polygons to crop to prior to export, then do the Export PDF command and on the Gridding tab select to Grid to the selected areas. This will do a separate export for each selected area and you can select which attribute to use for naming the individual PDF files that are exported.

    In the future we also likely add a specific Map Book export option for PDF to create a multi-page PDF file.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • JamesRutterJamesRutter Global Mapper User Posts: 98Trusted User
    edited August 2012
    Damn...I should have guessed there would already have been a quicker way to do this in GM...just tried doing it from the user interface...much nicer. Still need to use buffers as there could do with an option of 'padding' the polygons so there is a bit of mapping surrounding them, instead of the polygons being drawn right to the map edge.

    Useful to find out how powerful the scripting is though! Also re Map Book export dialogue...very good idea and would fit with the existing large range of GM export options. Would be useful to get a spec together. Personally I'd like to see the following:
    -option to pad single polygons by say a 50m buffer to supply some mapping context around the perimiter of the polygon
    -option to amalgamate all the single pdf docs produced into one big pdf file
    -option to add text overlays on to each pdf sheet which is populated with polygon attribute data - in the same way the file naming can use polygon attribute information
    -option to produce an index sheet, creating polygons for each sheet of paper produced with a page number attribute used for labelling purposes
    -option to get a map book created at a continuous scale, but making sure there is at least one sheet covering all data on a specific layer...we recently needed a map book showing the grass cutting on highway verges for everywhere in the borough and this mode of operation is handy (as opposed to gridding by individual polygons the map layer is scanned first and sheets created for everywhere that there is some data all at the same scale)

    Many thanks for the help on this.

    James
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited August 2012
    James,

    Thanks for the additional list of requests for map books, that's basically what we have in mind for our map book PDF functionality. Our internal task list number for this is 9967.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
Sign In or Register to comment.