Mapping

QGIS Python API – How to Export a Map

Here is the Python code I use with QGIS 3.0 to export to an image from a layout you have previously set up and saved in your project.

        layout = QgsProject.instance().layoutManager().layoutByName("YourLayoutName")
        export = QgsLayoutExporter(layout)
        export.exportToImage("YourPath/YourFilename"+".jpg", QgsLayoutExporter.ImageExportSettings())

For a PDF export you would use:

        layout = QgsProject.instance().layoutManager().layoutByName("YourLayoutName")
        export = QgsLayoutExporter(layout)
        export.exportToPdf("YourPath/YourFilename"+".pdf", QgsLayoutExporter.PdfExportSettings())

The API is a bit confusing, and some things are broken out of the box in QGIS 3.0 but it’s gotten better with subsequent revisions. QGISLayoutExporter API Documentation. I suggest updating your version of QGIS to the latest stable version, which as of now is QGIS 3.4.3 but may be newer depending on when you find this webpage.

Warmth

Why Are There Palm Trees in Los Angeles?

Why Are There Palm Trees in Los Angeles?

Let’s go back in time, to Los Angeles in 1875. Here’s what you see: basically nothing. The town—and “town” is even sort of grand for what it was—has about 8,000 people in it. But here’s something weirder: there are no palm trees. As a matter of fact, there aren’t really any trees at all. This area is just sort of a scrubland desert.

Over the next 50 years, palm trees would become a major transformative force in the development of Los Angeles. This is despite the fact that they don’t really do anything. The trees of urban Los Angeles do not provide shade or fruit or wood. They are lousy at preventing erosion. What they do, and what they did, is stranger: they became symbols.

History of the American Chestnut | The American Chestnut Foundation

History of the American Chestnut | The American Chestnut Foundation

More than a century ago, nearly 4 billion American chestnut trees were growing in the eastern U.S. They were among the largest, tallest, and fastest-growing trees. The wood was rot-resistant, straight-grained, and suitable for furniture, fencing, and building. The nuts fed billions of wildlife, people and their livestock. It was almost a perfect tree, that is, until a blight fungus killed it more than a century ago. The chestnut blight has been called the greatest ecological disaster to strike the world’s forests in all of history.

The American chestnut tree survived all adversaries for 40 million years, then disappeared within 40.