Blog d’Anita Graser

https://anitagraser.com

  • 24 mai 2020Movement data in GIS #30: synchronized trajectory animations with QGIS temporal controller
    QGIS Temporal Controller is a powerful successor of TimeManager. Temporal Controller is a new core feature of the current development version and will be shipped with the 3.14 release. This post demonstrates two key advantages of this new temporal support: Expression support for defining start and end timestamps Integration into the PyQGIS API These features come in very handy in many use cases. For example, they make it much easier to create animations from folders full of GPS tracks since the files can now be loaded and configured automatically: Script & Temporal Controller in action (click for full resolution) All tracks start at the same location but at different times. (Kudos for Andrew Fletcher for recordings these tracks and sharing them with me!) To create an animation that shows all tracks start simultaneously, we need to synchronize them. This synchronization can be achieved on-the-fly by subtracting the start time from all track timestamps using an expression: directory = « E:/Google Drive/QGIS_Course/05_TimeManager/Example_Dayrides/ » def load_and_configure(path): path = os.path.join(directory, filename) uri = ‘file:///’ + path + « ?type=csv&escape=&useHeader=No&detectType …
  • 21 mai 2020Spatial on air: talking Python on the MapScaping Podcast
    Podcasts have become huge. I’m an avid listener of podcasts myself. I particularly enjoy formats that take the time to talk about unconventional topics in detail. My first podcast experience was on the QGIS podcast hosted by Tim Sutton in 2014. Unfortunately, it seems like the podcast episodes are not online anymore. Recently, I had the pleasure to join the MapScaping Podcast by Daniel O’Donohue to talk about Python for Geospatial:  Other guests Daniel has already interviewed include: Kurt Menke talking first about QGIS and in a second episode on QField and Input (data collection apps based on QGIS) and Paul Ramsey on Vector Tiles from PostGIS Another geospatial podcast I really enjoy is The Mappyist Hour by Silas and Todd. Unfortunately, it’s a bit silent there now but it’s definitely worth to listen into their episode archive. One of my favorites is Episode 9 where Linda Stevens (Hecht) discusses her career at ESRI, the future of GIS, and the role of Open Source Spatial in that future: [soundcloud url="https://api.soundcloud.com/tracks/470759232" params="visual=true&show_artwork=true&maxwidth=545&maxheight=818&dnt=1" width="100%" height="400" iframe="true" /] If you listen to and …
  • 10 mai 2020TimeManager is dead, long live the Temporal Controller!
    TimeManager turns 10 this year. The code base has made the transition from QGIS 1.x to 2.x and now 3.x and it would be wrong to say that it doesn’t show 😉 Now, it looks like the days of TimeManager are numbered. Four days ago, Nyall Dawson has added native temporal support for vector layers to QGIS. This is part of a larger effort of adding time support for rasters, meshes, and now also vectors. The new Temporal Controller panel looks similar to TimeManager. Layers are configured through the new Temporal tab in Layer Properties. The temporal dimension can be used in expressions to create fancy time-dependent styles: TimeManager Geolife demo converted to Temporal Controller (click for full resolution) Obviously, this feature is brand new and will require polishing. Known issues listed by Nyall include limitations of supported time fields (only fields with datetime type are supported right now, strings cannot be used) and worse performance than TimeManager since features are filtered in QGIS rather than in the backend. If you want to give the new Temporal Controller a try, you need to install the current development version, e.g. qgis-dev in OSGeo4W. Update from May 16: Many of the …
  • 2 mai 2020QGIS video tutorials: election maps, hydrology, and more

    Mapping spatial decision patterns, such as election results, is always a hot topic. That’s why we decided to include a recipe for election maps in our QGIS Map Design books. What’s new is that this recipe is now available as a free video tutorial recorded by Oliver Burdekin:

    This video is just one of many recently published video tutorials that have been created by QGIS community members.

    For example, Hans van der Kwast and Kurt Menke have recorded a 7-part series on QGIS for Hydrological Applications:

    and Klas Karlsson’s Youtube channel is also always worth a follow:

    For the Pythonically inclined among you, there is also a new version of Python in QGIS on the Automating GIS-processes channel:

     

  • 12 avril 2020Super-quick interactive data & parameter exploration
    This post introduces Holoviz Panel, a library that makes it possible to create really quick dashboards in notebook environments as well as more sophisticated custom interactive web apps and dashboards. The following example shows how to use Panel to explore a dataset (a trajectory collection in this case) and different parameter settings (relating to trajectory generalization). All the Panel code we need is a dict that defines the parameters that we want to explore. Then we can use Panel’s interact function to automatically generate a dashboard for our custom plotting function: import panel as pn kw = dict(traj_id=(1, len(traj_collection)), tolerance=(10, 100, 10), generalizer=[‘douglas-peucker’, ‘min-distance’]) pn.interact(plot_generalized, **kw) Click to view the resulting dashboard in full resolution: The plotting function uses the parameters to generate a Holoviews plot. First it fetches a specific trajectory from the trajectory collection. Then it generalizes the trajectory using the specified parameter settings. As you can see, we can easily combine maps and other plots to visualize different aspects of the data: def plot_generalized(traj_id=1, tolerance=10, generalizer=’dou …
  • 21 mars 2020MovingPandas v0.3 released!
    MovingPandas has come a long way since 2018 when I started to experiment with GeoPandas for trajectory data handling. This week, MovingPandas passed peer review and was approved for pyOpenSci. This technical review process was extremely helpful in ensuring code, project, and documentation quality. I would strongly recommend it to everyone working on new data science libraries! The lastest v0.3 release is now available from conda-forge. All tutorials are available on MyBinder New features include: Support for GeoPandas 0.7 Trajectory collection aggregation functions to generate flow maps   …
  • 2 mars 2020Movement data in GIS #29: power your web apps with movement data using mobilitydb-sqlalchemy
    This is a guest post by Bommakanti Krishna Chaitanya @chaitan94 Introduction This post introduces mobilitydb-sqlalchemy, a tool I’m developing to make it easier for developers to use movement data in web applications. Many web developers use Object Relational Mappers such as SQLAlchemy to read/write Python objects from/to a database. Mobilitydb-sqlalchemy integrates the moving objects database MobilityDB into SQLAlchemy and Flask. This is an important step towards dealing with trajectory data using appropriate spatiotemporal data structures rather than plain spatial points or polylines. To make it even better, mobilitydb-sqlalchemy also supports MovingPandas. This makes it possible to write MovingPandas trajectory objects directly to MobilityDB. For this post, I have made a demo application which you can find live at https://mobilitydb-sqlalchemy-demo.adonmo.com/. The code for this demo app is open source and available on GitHub. Feel free to explore both the demo app and code! In the following sections, I will explain the most important parts of this demo app, to show how to use mobilitydb-sqlalchemy in your own webapp. If you want to reproduce this demo, you can clone the demo re …
  • 21 février 2020Movement data in GIS #28: open geospatial tools for movement data exploration
    We recently published a new paper on “Open Geospatial Tools for Movement Data Exploration” (open access). If you liked Movement data in GIS #26: towards a template for exploring movement data, you will find even more information about the context, challenges, and recent developments in this paper. It also presents three open source stacks for movement data exploration: QGIS + PostGIS: a combination that will be familiar to most open source GIS users Jupyter + MovingPandas: less common so far, but Jupyter notebooks are quickly gaining popularity (even in the proprietary GIS world) GeoMesa + Spark: for when datasets become too big to handle using other means and discusses their capabilities and limitations: This post is part of a series. Read more about movement data in GIS. …
  • 2 février 2020First working MovingPandas setup on Databricks
    In December, I wrote about GeoPandas on Databricks. Back then, I also tried to get MovingPandas working but without luck. (While GeoPandas can be installed using Databricks’ dbutils.library.installPyPI(« geopandas ») this PyPI install just didn’t want to work for MovingPandas.) Now that MovingPandas is available from conda-forge, I gave it another try and … *spoiler alert* … it works! First of all, conda support on Databricks is in beta. It’s not included in the default runtimes. At the time of writing this post, “6.0 Conda Beta” is the latest runtime with conda: Once the cluster is up and connected to the notebook, a quick conda list shows the installed packages: Time to install MovingPandas! I went with a 100% conda-forge installation. This takes a looong time (almost half an hour)! When the installs are finally done, it get’s serious: time to test the imports! Success! Now we can put the MovingPandas data structures to good use. But first we need to load some movement data: Or course, the points in this GeoDataFrame can be plotted. However, the plot isn’t automatically displayed once plot() is called on the GeoDataFrame. Instead, Databricks provides a display() function to display …
  • 12 janvier 2020Movement data in GIS #27: extracting trip origin clusters from MovingPandas trajectories
    This post is a follow-up to the draft template for exploring movement data I wrote about in my previous post. Specifically, I want to address step 4: Exploring patterns in trajectory and event data. The patterns I want to explore in this post are clusters of trip origins. The case study presented here is an extension of the MovingPandas ship data analysis notebook. The analysis consists of 4 steps: Splitting continuous GPS tracks into individual trips Extracting trip origins (start locations) Clustering trip origins Exploring clusters Since I have already removed AIS records with a speed over ground (SOG) value of zero from the dataset, we can use the split_by_observation_gap() function to split the continuous observations into individual trips. Trips that are shorter than 100 meters are automatically discarded as irrelevant clutter: traj_collection.min_length = 100 trips = traj_collection.split_by_observation_gap(timedelta(minutes=5)) The split operation results in 302 individual trips: Passenger vessel trajectories are blue, high-speed craft green, tankers red, and cargo vessels orange. Other vessel trajectories are gray. To extract trip origins, we can use the get_start_location …