29 août 2024Building spatial analysis assistants using OpenAI’s Assistant API Earlier this year, I shared my experience using ChatGPT’s Data Analyst web interface for analyzing spatiotemporal data in the post “ChatGPT Data Analyst vs. Movement Data”. The Data Analyst web interface, while user-friendly, is not equipped to handle all types of spatial data tasks, particularly those involving more complex or large-scale datasets. Additionally, because the code is executed on a remote server, we’re limited to the libraries and tools available in that environment. I’ve often encountered situations where the Data Analyst simply doesn’t have access to the necessary libraries in its Python environment, which can be frustrating if you need specific GIS functionality. Today, we’ll therefore start to explore alternatives to ChatGPT’s Data Analyst Web Interface, specifically, the OpenAI Assistant API. Later, I plan to dive deeper into even more flexible approaches, like Langchain’s Pandas DataFrame Agents. We’ll explore these options using spatial analysis workflow, such as: Loading a zipped shapefile and investigate its content Finding the three largest cities in the dataset Selecting all cities in a region, e.g. in Scandinavia from the dataset Creating static and inter …
23 août 2024MovingPandas 0.19 released! This release is the first to support GeoPandas 1.0. Additionally, this release adds multiple new features, including: New explore() function adds interactive folium / leaflet maps New support for mfjson trajectory For the full change log, check out the release page. We have also revamped the documentation at https://movingpandas.readthedocs.io/ using the PyData Sphinx Theme: On a related note: if you know what I need to change to get all Trajectory functions listed in the TOC on the right, please let me know. …
12 juillet 2024Trajectools 2.2 released If you downloaded Trajectools 2.1 and ran into troubles due to the introduced scikit-mobility and gtfs_functions dependencies, please update to Trajectools 2.2. This new version makes it easier to set up Trajectools since MovingPandas is pip-installable on most systems nowadays and scikit-mobility and gtfs_functions are now truly optional dependencies. If you don’t install them, you simply will not see the extra algorithms they add: If you encounter any other issues with Trajectools or have questions regarding its usage, please let me know in the Trajectools Discussions on Github. …
8 juillet 2024New MovingPandas tutorial: taking OGC Moving Features full circle with MF-JSON Last week, I had the pleasure to meet some of the people behind the OGC Moving Features Standard Working group at the IEEE Mobile Data Management Conference (MDM2024). While chatting about the Moving Features (MF) support in MovingPandas, I realized that, after the MF-JSON update & tutorial with official sample post, we never published a complete tutorial on working with MF-JSON encoded data in MovingPandas. The current MovingPandas development version (to be release as version 0.19) supports: Reading MF-JSON MovingPoint (single trajectory features and trajectory collections) Reading MF-JSON Trajectory Writing MovingPandas Trajectories and TrajectoryCollections to MF-JSON MovingPoint This means that we can now go full circle: reading — writing — reading. Reading MF-JSON Both MF-JSON MovingPoint encoding and Trajectory encoding can be read using the MovingPandas function read_mf_json(). The complete Jupyter notebook for this tutorial is available in the project repo. Here we read one of the official MF-JSON MovingPoint sample files: traj = mpd.read_mf_json(‘data/movingfeatures.json’) Writing MF-JSON To write MF-JSON, the Trajectory and TrajectoryCollection classes provide a to_mf_js …
30 juin 2024New interactive trajectory plots for MovingPandas & experiments on their interpretation using ChatGPT 4o With the release of GeoPandas 1.0 this month, we’ve been finally able to close a long-standing issue in MovingPandas by adding support for the explore function which provides interactive maps using Folium and Leaflet. Explore() will be available in the upcoming MovingPandas 0.19 release if your Python environment includes GeoPandas >= 1.0 and Folium. Of course, if you are curious, you can already test this new functionality using the current development version. This enables users to access interactive trajectory plots even in environments where it is not possible to install geoviews / hvplot (the previously only option for interactive plots in MovingPandas). I really like the legend for the speed color gradient, but unfortunately, the legend labels are not readable on the dark background map since they lack the semi-transparent white background that has been applied to the scale bar and credits label. Speaking of reading / interpreting the plots … You’ve probably seen the claims that AI will help make tools more accessible. Clearly AI can interpret and describe photos, but can it also interpret MovingPandas plots? ChatGPT 4o interpretations of MovingPandas plots Not bad. And what …
30 mai 2024ChatGPT Data Analyst vs movement data Today, I took ChatGPT’s Data Analyst for a spin. You’ve probably seen the fancy advertising videos: just drop in a dataset and AI does all the analysis for you?! Let’s see … Of course, I’m not going to use some lame movie database or flower petals data. Instead, let’s go all in and test with a movement dataset. You don’t get a second chance to make a first impression, they say. — Well, Data Analyst, you didn’t impress on the first try. How hard can it be to guess the delimiter and act accordingly? Anyway, let’s help it a little: That looks much better. It makes an effort to guess what the columns could mean and successfully identifies the spatiotemporal information. Now for some spatial analysis. On first try, it didn’t want to calculate the length of the trajectories in geographic terms, but we can make it to: It will also show the code used to get to the results: And indeed, these are close enough to the results computed using MovingPandas: “What about plots?” I hear you ask. For a first try, not bad at all: Let’s see if we can push it further: Looks like poor Data Analyst ended up in geospatial library dependency hell It’s interesting to watch it try find a solution. Alas, no ba …
20 mai 2024New Trajectools 2.1 and MovingPandas 0.18 releases Today marks the 2.1 release of Trajectools for QGIS. This release adds multiple new algorithms and improvements. Since some improvements involve upstream MovingPandas functionality, I recommend to also update MovingPandas while you’re at it. If you have installed QGIS and MovingPandas via conda / mamba, you can simply: conda activate qgis mamba install movingpandas=0.18 Afterwards, you can check that the library was correctly installed using: import movingpandas as mpdmpd.show_versions() Trajectools 2.1 The new Trajectools algorithms are: Trajectory overlay — Intersect trajectories with polygon layer Privacy — Home work attack (requires scikit-mobility) This algorithm determines how easy it is to identify an individual in a dataset. In a home and work attack the adversary knows the coordinates of the two locations most frequently visited by an individual. GTFS — Extract segments (requires gtfs_functions) GTFS — Extract shapes (requires gtfs_functions) These algorithms extract public transport routes (GTFS shapes) and route segments between stops (GTFS segments) from GTFS ZIP files using gtfs_functions.Feed.shapes and .segments, respectively. Furthermore, we have fixed issue with pr …
4 mai 2024GTFS algorithms about to land in Trajectools Trajectools continues growing. Lately, we have started expanding towards public transport analysis. The algorithms available through the current Trajectools development version are courtesy of the gtfs_functions library. There are a couple of existing plugins that deal with GTFS. However, in my experience, they either don’t integrate with Processing and/or don’t provide the functions I was expecting. So far, we have two GTFS algorithms to cover essential public transport analysis needs: The “Extract shapes” algorithm gives us the public transport routes: The “Extract segments” algorithm has one more options. In addition to extracting the segments between public transport stops, it can also enrich the segments with the scheduled vehicle speeds: Here you can see the scheduled speeds: To show the stops, we can put marker line markers on the segment start and end locations: The segments contain route information and stop names, so these can be extracted and used for labeling as well: If you want to reproduce the above examples, grab the open Vorarlberg public transport schedule GTFS. These developments are supported by the Emeralds Horizon Europe project. …
20 avril 2024QGIS Server — Docker edition Today’s post is a QGIS Server update. It’s been a while (12 years ) since I last posted about QGIS Server. It would be an understatement to say that things have evolved since then, not least due to the development of Docker which, Wikipedia tells me, was released 11 years ago. There have been multiple Docker images for QGIS Server provided by QGIS Community members over the years. Recently, OPENGIS.ch’s Docker image has been adopted as official QGIS Server image https://github.com/qgis/qgis-docker which aims to be a starting point for users to develop their own customized applications. The following steps have been tested on Ubuntu (both native and in WSL). First, we need Docker. I installed Docker from the apt repository as described in the official docs. Once Docker is set up, we can get the QGIS Server, e.g. for the LTR: docker pull qgis/qgis-server:ltr Now we only need to start it: docker run -v $(pwd)/qgis-server-data:/io/data –name qgis-server -d -p 8010:80 qgis/qgis-server:ltr Note how we are mapping the qgis-server-data directory in our current working directory to /io/data in the container. This is where we’ll put our QGIS project files. We can already check out the OGC A …
18 mars 2024Getting started with pygeoapi processes Today’s post is a quick introduction to pygeoapi, a Python server implementation of the OGC API suite of standards. OGC API provides many different standards but I’m particularly interested in OGC API – Processes which standardizes geospatial data processing functionality. pygeoapi implements this standard by providing a plugin architecture, thereby allowing developers to implement custom processing workflows in Python. I’ll provide instructions for setting up and running pygeoapi on Windows using Powershell. The official docs show how to do this on Linux systems. The pygeoapi homepage prominently features instructions for installing the dev version. For first experiments, however, I’d recommend using a release version instead. So that’s what we’ll do here. As a first step, lets install the latest release (0.16.1 at the time of writing) from conda-forge: conda create -n pygeoapi python=3.10conda activate pygeoapimamba install -c conda-forge pygeoapi Next, we’ll clone the GitHub repo to get the example config and datasets: cd C:\Users\anita\Documents\GitHub\git clone https://github.com/geopython/pygeoapi.gitcd pygeoapi\ To finish the setup, we need some configurations: cp pygeoapi-c …
Besoin de conseils, assistance, formation?
Visitez le site de NASCA et découvrez toutes nos offres de coaching SIG