Blog d’Anita Graser

https://anitagraser.com

  • 24 février 2024Trajectools 2.0 released 🎉
    It’s my pleasure to share with you that Trajectools 2.0 just landed in the official QGIS Plugin Repository. This is the first version without the “experimental” flag. If you look at the plugin release history, you will see that the previous release was from 2020. That’s quite a while ago and a lot has happened since, including the development of MovingPandas. Let’s have a look what’s new! The old “Trajectories from point layer”, “Add heading to points”, and “Add speed (m/s) to points” algorithms have been superseded by the new “Create trajectories” algorithm which automatically computes speeds and headings when creating the trajectory outputs. “Day trajectories from point layer” is covered by the new “Split trajectories at time intervals” which supports splitting by hour, day, month, and year. “Clip trajectories by extent” still exists but, additionally, we can now also “Clip trajectories by polygon layer” There are two new event extraction algorithms to “Extract OD points” and “Extract OD points”, as well as the related “Split trajectories at stops”. Additionally, we can also “Split trajectories at observation gaps”. Trajectory outputs, by default, come as a pair of a point layer …
  • 3 février 2024Finding geospatial accounts on Mastodon
    Besides following hashtags, such as #GISChat, #QGIS, #OpenStreetMap, #FOSS4G, and #OSGeo, curating good lists is probably the best way to stay up to date with geospatial developments. To get you started (or to potentially enrich your existing lists), I thought I’d share my Geospatial and SpatialDataScience lists with you. And the best thing: you don’t need to go through all the >150 entries manually! Instead, go to your Mastodon account settings and under “Import and export” you’ll find a tool to import and merge my list.csv with your lists: And if you are not following the geospatial hashtags yet, you can search or click on the hashtags you’re interested in and start following to get all tagged posts into your timeline: …
  • 27 janvier 2024Trajectools update: stop detection & trajectory styling
    The Trajectools toolbox has continued growing: I’m continuously testing the algorithms integrated so far to see if they work as GIS users would expect and can to ensure that they can be integrated in Processing model seamlessly. Because naming things is tricky, I’m currently struggling with how to best group the toolbox algorithms into meaningful categories. I looked into the categories mentioned in OGC Moving Features Access but honestly found them kind of lacking: Andrienko et al.’s book “Visual Analytics of Movement” comes closer to what I’m looking for: … but I’m not convinced yet. So take the above listed three categories with a grain of salt. Those may change before the release. (Any inputs / feedback / recommendation welcome!) Let me close this quick status update with a screencast showcasing stop detection in AIS data, featuring the recently added trajectory styling using interpolated lines: While Trajectools is getting ready for its 2.0 release, you can get the current development version directly from https://github.com/movingpandas/qgis-processing-trajectory. …
  • 12 janvier 2024QGIS Processing Trajectools v2 in the works
    Trajectools development started back in 2018 but has been on hold since 2020 when I realized that it would be necessary to first develop a solid trajectory analysis library. With the MovingPandas library in place, I’ve now started to reboot Trajectools. Trajectools v2 builds on MovingPandas and exposes its trajectory analysis algorithms in the QGIS Processing Toolbox. So far, I have integrated the basic steps of Building trajectories including speed and direction information from timestamped points and Splitting trajectories at observation gaps, stops, or regular time intervals. The algorithms create two output layers: Trajectory points with speed and direction information that are styled using arrow markers Trajectories as LineStringMs which makes it straightforward to count the number of trajectories and to visualize where one trajectory ends and another starts. So far, the default style for the trajectory points is hard-coded to apply the Turbo color ramp on the speed column with values from 0 to 50 (since I’m simply loading a ready-made QML). By default, the speed is calculated as km/h but that can be customized: I don’t have a solution yet to automatically create a style for t …
  • 15 décembre 2023Offline Vector Tile Package .vtpk in QGIS
    Starting from 3.26, QGIS now supports .vtpk (Vector Tile Package) files out of the box! From the changelog: ESRI vector tile packages (VTPK files) can now be opened directly as vector tile layers via drag and drop, including support for style translation. This is great news, particularly for users from Austria, since this makes it possible to use the open government basemap.at vector tiles directly, without any fuss: 1. Download the 2GB offline vector basemap from https://www.data.gv.at/katalog/de/dataset/basemap-at-verwaltungsgrundkarte-vektor-offline-osterreich 2. Add the .vtpk as a layer using the Data Source Manager or via drag-and-drop from the file explorer 3. All done and ready, including the basemap styling and labeling — which we can customize as well: Kudos to https://wien.rocks/@DieterKomendera/111568809248327077 for bringing this new feature to my attention. PS: And interesting tidbit from the developer of this feature, Nyall Dawson: …
  • 13 décembre 2023Hi ‘Geocomputation with Python’

    Today, I want to point out a blog post over at

    https://geocompx.org/post/2023/geocompy-bp1/

    In this post, Jakub Nowosad introduces our book “Geocomputation with Python”, also known as geocompy. It is an open-source book on geographic data analysis with Python, written by Michael Dorman, Jakub Nowosad, Robin Lovelace, and me with contributions from others. You can find it online at https://py.geocompx.org/

  • 9 décembre 2023Mapping relationships between Neo4j spatial nodes with GeoPandas
    Previously, we mapped neo4j spatial nodes. This time, we want to take it one step further and map relationships. A prime example, are the relationships between GTFS StopTime and Trip nodes. For example, this is the Cypher query to get all StopTime nodes of Trip 17: MATCH  (t:Trip  {id: « 17 »}) (s1:Stop) MATCH (st2)-[:STOPS_AT]->(s2:Stop) RETURN st1.departureTime AS time1, st2.arrivalTime AS time2, s1.location AS geom1, s2.location AS geom2, duration.inSeconds( time(st1.departureTime), time(st2.arrivalTime) ).seconds AS traveltime As always, here’s the notebook: https://github.com/anitagraser/QGIS-resources/blob/master/qgis3/notebooks/neo4j.ipynb …
  • 3 décembre 2023Mapping Neo4j spatial nodes with GeoPandas
    In the recent post Setting up a graph db using GTFS data & Neo4J, we noted that — unfortunately — Neomap is not an option to visualize spatial nodes anymore. GeoPandas to the rescue! But first we need the neo4j Python driver: pip install neo4j Then we can connect to our database. The default user name is neo4j and you get to pick the password when creating the database: from neo4j import GraphDatabase URI = « neo4j://localhost » AUTH = (« neo4j », « password ») with GraphDatabase.driver(URI, auth=AUTH) as driver: driver.verify_connectivity() Once we have confirmed that the connection works as expected, we can run a query: QUERY = « MATCH (p:Stop) RETURN p.name AS name, p.location AS geom » records, summary, keys = driver.execute_query( QUERY, database_= »neo4j », ) for rec in records: print(rec) Nice. There we have our GTFS stops, their names and their locations. But how to put them on a map? Conveniently, there is a to_db() function in the Neo4j driver: import geopandas as gpd import numpy as np with driver.session(database= »neo4j ») as session: tx = session.begin_transaction() results = tx.run(QUERY) df = results.to_df(expand=True) df = df[df[« geom[].0 »]>0] gdf = gpd.GeoDataFrame( df[‘name’ …
  • 28 novembre 2023Analyzing mobility hotspots with MovingPandas & CARTO
    Today, I want to point out a blog post over at https://carto.com/blog/analyzing-mobility-hotspots-with-movingpandas written together with my fellow co-authors and EMERALDS project team members Argyrios Kyrgiazos and Helen McKenzie. In this blog post, we walk you through a trajectory hotspot analysis using open taxi trajectory data from Kaggle, combining data preparation with MovingPandas (including the new OutlierCleaner illustrated above) and spatiotemporal hotspot analysis from Carto. …
  • 27 novembre 2023Setting up a graph db using GTFS data & Neo4J
    In a recent post, we looked into a graph-based model for maritime mobility data and how it may be represented in Neo4J. Today, I want to look into another type of mobility data: public transport schedules in GTFS format. In this post, I’ll be using the public GTFS data for Riga since Riga is one of the demo sites for our current EMERALDS research project. The workflow is heavily inspired by Bert Radke‘s post “Loading the UK GTFS data feed” from 2021 and his import Cypher script which I used as a template, adjusted to the requirements of the Riga dataset, and updated to recent Neo4J changes. Here we go. Since a GTFS export is basically a ZIP archive full of CSVs, we will be making good use of Neo4Js CSV loading capabilities. The basic script for importing the stops file and creating point geometries from lat and lon values would be: LOAD CSV with headers FROM « file:///stops.txt » AS row CREATE (:Stop { stop_id: row[« stop_id »], name: row[« stop_name »], location: point({ longitude: toFloat(row[« stop_lon »]), latitude: toFloat(row[« stop_lat »]) }) }) This requires that the stops.txt is located in the import directory of your Neo4J database. When we run the above script and the file is miss …