0

I´m almost sure that this is to tricky to solve. Often I have multiple combined polygons that I want to print. Until now I´ve devided all the polygons by the "Split vector layer", because I need to switch the rest off. By this method I´m printing one at time. Is there another and better way to do this? Solutions for Q-GIS, but Mapinfo is good as well.

  • 2
    Are you familiar with the Atlas feature in the QGIS Print Composer? You would create a specific layer based on your Split Vector Layer to guide Atlas. – Willy Mar 10 '14 at 11:36
  • Thx Willy- I will check it out. – CARTOS Mar 10 '14 at 12:01
  • 1
    This is great. Helped med a lot. – CARTOS Mar 10 '14 at 13:03
  • Credit for Atlas is due to the outstanding work of the QGIS dev team... – Willy Mar 11 '14 at 9:44
  • It´s a fantastic feature. Mapinfo just got further behind in the lane og development. – CARTOS Mar 13 '14 at 9:45
1

You can use the Atlas feature in QGIS. In MapInfo, you can use an add-on called MapShop or, if you don't mind doing a little scripting, I normally write a simple loop in MapBasic that moves the map window to the centroid of each object and prints a map.

EDIT: Here is a simple code sample of a MapBasic loop to print a table of objects. Paste it into MapBasic and compile it to create an MBX that can be run in MapInfo Pro.

Declare Sub Main()
Sub Main()
    ' Replace PolygonTable with your table containing the polygons to be printed
    Select * From PolygonTable Into TempLoopTable Noselect 
    ' Set the working MapBasic projection to the same as the PolygonTable 
    Set CoordSys Table PolygonTable

    Dim boundingRectangle As Object
    Dim centerX, centerY As Float

    Fetch First From TempLoopTable
    While Not EOT(TempLoopTable)
        boundingRectangle = MBR(TempLoopTable.obj)
        centerX = CentroidX(boundingRectangle)
        centerY = CentroidY(boundingRectangle)
        Set Map Window FrontWindow() Center (centerX, centerY) Zoom 100 'Replace 100 with any window width or can be calculated
        PrintWin Window FrontWindow()
        Fetch Next From TempLoopTable
    WEnd
End Sub

This is the rough idea. You can look up commands and functions like EOT(), MBR(), FrontWindow(), Set Map etc. in the MapBasic help if you're not sure how they work. This just scratches the surface. I usually calculate athe zoom width for each object based on its height and width.

  • Interesting. How do you write that loop in map basic? I'll check MapShop also. Great knowledge! – CARTOS Mar 18 '14 at 21:35
  • Code sample added – Damien Mar 21 '14 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.