Blog d’Anita Graser

https://anitagraser.com

  • Drive-time Isochrones from a single Shapefile using QGIS, PostGIS, and Pgrouting 11 septembre 2017
    This is a guest post by Chris Kohler @Chriskohler8. Introduction: This guide provides step-by-step instructions to produce drive-time isochrones using a single vector shapefile. The method described here involves building a routing network using a single vector shapefile of your roads data within a Virtual Box. Furthermore, the network is built by creating start and end nodes (source and target nodes) on each road segment. We will use Postgresql, with PostGIS and Pgrouting extensions, as our database. Please consider this type of routing to be fair, regarding accuracy, as the routing algorithms are based off the nodes locations and not specific addresses. I am currently working on an improved workflow to have site address points serve as nodes to optimize results. One of the many benefits of this workflow is no financial cost to produce (outside collecting your roads data). I will provide instructions for creating, and using your virtual machine within this guide. Steps:–Getting Virtual Box(begin)– Intro 1. Download/Install Oracle VM(https://www.virtualbox.org/wiki/Downloads) Intro 2. Start the download/install OSGeo-Live 11(https://live.osgeo.org/en/overview/overview.html). Pictur …
  • Fixing invalid polygon geometries 29 août 2017
    Invalid geometries can cause a lot of headache: from missing features to odd analysis results. This post aims to illustrate one of the most common issues and presents an approach that can help with these errors. The dataset used for this example is the Alaska Shapefile from the QGIS sample data: This dataset has a couple of issues. One way to find out if a dataset contains errors is the Check Validity tool in the Processing toolbox: If there are errors, a layer called Error output will be loaded. In our case, there are multiple issues: If we try to use this dataset for spatial analysis, there will likely be errors. For example, using the Fixed distance buffer tool results in missing features: Note the errors in the Processing log message panel: Feature ### has invalid geometry. Skipping … So what can we do? In my experience, GRASS can work wonders for fixing these kind of issues. The idea is to run v.buffer.distance with the distance set to zero: This will import the dataset into GRASS and run the buffer algorithm without actually growing the polygons. Finally, it should export a fixed version of the geometries: A quick validity check with the Check validity tool confirms that th …
  • Getting started with GeoMesa using Geodocker 27 août 2017
    In a previous post, I showed how to use docker to run a single application (GeoServer) in a container and connect to it from your local QGIS install. Today’s post is about running a whole bunch of containers that interact with each other. More specifically, I’m using the images provided by Geodocker. The Geodocker repository provides a setup containing Accumulo, GeoMesa, and GeoServer. If you are not familiar with GeoMesa yet: GeoMesa is an open-source, distributed, spatio-temporal database built on a number of distributed cloud data storage systems … GeoMesa aims to provide as much of the spatial querying and data manipulation to Accumulo as PostGIS does to Postgres. The following sections show how to load data into GeoMesa, perform basic queries via command line, and finally publish data to GeoServer. The content is based largely on two GeoMesa tutorials: Geodocker: Bootstrapping GeoMesa Accumulo and Spark on AWS and Map-Reduce Ingest of GDELT, as well as Diethard Steiner’s post on Accumulo basics. The key difference is that this tutorial is written to be run locally (rather than on AWS or similar infrastructure) and that it spells out all user names and passwords preconfigured i …
  • Movement data in GIS #7: animated trajectories with TimeManager 14 août 2017
    In this post, we use TimeManager to visualize the position of a moving object over time along a trajectory. This is another example of what is possible thanks to QGIS’ geometry generator feature. The result can look like this: What makes this approach interesting is that the trajectory is stored in PostGIS as a LinestringM instead of storing individual trajectory points. So there is only one line feature loaded in QGIS: (In part 2 of this series, we already saw how a geometry generator can be used to visualize speed along a trajectory.) The layer is added to TimeManager using t_start and t_end attributes to define the trajectory’s temporal extent. TimeManager exposes an animation_datetime() function which returns the current animation timestamp, that is, the timestamp that is also displayed in the TimeManager dock, as well as on the map (if we don’t explicitly disable this option). Once TimeManager is set up, we can edit the line style to add a point marker to visualize the position of the moving object at the current animation timestamp. To do that, we interpolate the position along the trajectory segments. The first geometry generator expression splits the trajectory in its segme …
  • Dynamic styling expressions with aggregates & variables 22 juillet 2017
    In a recent post, we used aggregates for labeling purposes. This time, we will use them to create a dynamic data driven style, that is, a style that automatically adjusts to the minimum and maximum values of any numeric field … and that field will be specified in a variable! But let’s look at this step by step. (This example uses climate.shp from the QGIS sample dataset.) Here is a basic expression for data defined symbol color using a color ramp: Similarly, we can configure a data defined symbol size to create a style like this: Temperatures in July To stretch the color ramp from the attribute field’s minimum to maximum value, we can use aggregate functions: That’s nice but if we want to be able to quickly switch to a different attribute field, we now have two expressions (one for color and one for size) to change. This can get repetitive and can be the source of errors if we miss an expression and don’t update it correctly … To avoid these issues, we use a layer variable to store the name of the field that we want to use. Layer variables can be configured in layer properties: Then we adjust our expression to use the layer variable. Here is where it gets a bit tricky. We cannot si …
  • Docker basics with Geodocker GeoServer 12 juillet 2017
    Today’s post is mostly notes-to-self about using Docker. These steps were tested on a fresh Ubuntu 17.04 install. Install Docker as described in https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ “Install using the repository” section. Then add the current user to the docker user group (otherwise, all docker commands have to be prefixed with sudo) $ sudo gpasswd -a $USER docker $ newgrp docker Test run the hello world image $ docker run hello-world For some more Docker basics, see https://github.com/docker/labs/blob/master/beginner/chapters/alpine.md. Pull Geodocker images, for example from https://quay.io/organization/geodocker $ docker pull quay.io/geodocker/base $ docker pull quay.io/geodocker/geoserver Get a list of pulled images $ docker images REPOSITORY TAG IMAGE ID CREATED SIZE quay.io/geodocker/geoserver latest c60753e05956 8 months ago 904MB quay.io/geodocker/base latest 293209905a47 8 months ago 646MB Test run quay.io/geodocker/base $ docker run -it –rm quay.io/geodocker/base:latest java -version java version « 1.8.0_45 » Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) Run quay.io/geodoc …
  • Even more aggregations: QGIS point cluster renderer 13 juin 2017
    In the previous post, I demonstrated the aggregation support in QGIS expressions. Another popular request is to aggregate or cluster point features that are close to each other. If you have been following the QGIS project on mailing list or social media, you probably remember the successful cluster renderer crowd-funding campaign by North Road. The point cluster renderer is implemented and can be tested in the current developer version. The renderer is highly customizable, for example, by styling the cluster symbol and adjusting the distance between points that should be in the same cluster: Beyond this basic use case, the point cluster renderer can also be combined with categorized visualizations and clusters symbols can be colored in the corresponding category color and scaled by cluster size, as demoed in this video by the developer Nyall Dawson: …
  • Aggregate all the things! (QGIS expression edition) 8 juin 2017
    In the past, aggregating field values was reserved to databases, virtual layers, or dedicated plugins, but since QGIS 2.16, there is a way to compute aggregates directly in QGIS expressions. This means that we can compute sums, means, counts, minimum and maximum values and more! Here’s a quick tutorial to get you started: Load the airports from the QGIS sample dataset. We’ll use the elevation values in the ELEV field for the following examples: QGIS sample airport dataset – categorized by USE attribute The most straightforward expressions are those that only have one parameter: the name of the field that should be aggregated, for example: mean(ELEV) We can also add a second parameter: a group-by field, for example, to group by the airport usage type, we use: mean(ELEV,USE) To top it all off, we can add a third parameter: a filter expression, for example, to show only military airports, we use: mean(ELEV,USE,USE=’Military’) Last but not least, all this aggregating goodness also works across layers! For example, here is the Alaska layer labeled with the airport layer feature count: aggregate(‘airports’,’count’, »ID ») If you are using relations, you can even go one step further and cal …
  • Upcoming QGIS3 features – exploring the current developer version 23 mai 2017
    There are tons of things going on under the hood of QGIS for the move from version 2 to version 3. Besides other things, we’ll have access to new versions of Qt and Python. If you are using a HiDPI screen, you should see some notable improvements in the user interface of QGIS 3. But of course QGIS 3 is not “just” a move to updated dependencies. Like in any other release, there are many new features that we are looking forward to. This list is only a start, including tools that already landed in the developer version 2.99: Improved geometry editing  When editing geometries, the node tool now behaves more like editing tools in webmaps: instead of double-clicking to add a new node, the tool automatically suggests a new node when the cursor hovers over a line segment. In addition, improvements include an undo and redo panel for quick access to previous versions. Improved Processing dialogs Like many other parts of the QGIS user interface, Processing dialogs now prominently display the function help. In addition, GDAL/OGR tools also show the underlying GDAL/OGR command which can be copy-pasted to use it somewhere else. New symbols and predefined symbol groups The default symbols have be …
  • Movement data in GIS #6: updates from AGILE2017 21 mai 2017
    AGILE 2017 is the annual international conference on Geographic Information Science of the Association of Geographic Information Laboratories in Europe (AGILE) which was established in 1998 to promote academic teaching and research on GIS. This years conference in Wageningen was my time at AGILE.  I had the honor to present our recent work on pedestrian navigation with landmarks [Graser, 2017]. If you are interested in trying it, there is an online demo. The conference also provided numerous pointers toward ideas for future improvements, including [Götze and Boye, 2016] and [Du et al., 2017] natural language from geom relations – would be a good add-on for our navigation instruction generator https://t.co/jO0khPfnHE #agilewag2017 pic.twitter.com/9B5F0jxvkQ — Anita Graser (@underdarkGIS) May 9, 2017 On the issue of movement data in GIS, there weren’t too many talks on this topic at AGILE but on the conceptual side, I really enjoyed David Jonietz’ talk on how to describe trajectory processing steps: Source: [Jonietz and Bucher, 2017] In the pre-conference workshop I attended, there was also an interesting presentation on analyzing trajectory data with PostGIS by Phd candidate Meihan …