Accessing the OpenStreetMap API with Python directly

Posted on 2024-04-16, by Racum. Tags: GIS OpenStreetMap JSON Python Shapely

On a previous article called "OpenStreetMap to GeoJSON", I explained how to extract Polygons from OSM using an online tool provided by from OSM France. And, on this article, I’ll explain how do that yourself directly using the OSM API and Python.

This also explains the basic concepts I used to write the osmexp tool, to export OSM elements into GeoJSON from the command-line.

Shapely example: Where to build cell-towers?

Posted on 2024-01-27, by Racum. Tags: GIS Python GeoJSON Shapely

This is a fun example of how to use Shapely to solve geographical problems. On this article I show how to cover a polygon with circles in a hexagonal pattern.

Promoting simple Django fields to ForeignKeys

Posted on 2024-01-23, by Racum. Tags: Django Python

Did you ever change your mind about your Django database structure? Sometimes you need to create references between models, but for some reason you didn’t use a ForeignKey field, and there are good cases for that, for example: the ID came from a different system, but you decided to have a local copy. On this article I show how to convert it the proper way.

Introduction to PostgreSQL Arrays

Posted on 2024-01-14, by Racum. Tags: PostgresSQL

Arrays in PostgreSQL are very useful to represent lists of data without the need of extra “many-to-many” tables, but to take advantage of them, you need to know the basics; follow this article to learn them.

Calculate local time with UTC and location

Posted on 2024-01-05, by Racum. Tags: GIS Python GeoJSON

When working with remote sensing, it is very common to save time data in a single timezone (usually UTC), this article shows how to convert that into local time based on the provided coordinates.

Developer predictions for 2024

Posted on 2023-12-31, by Racum. Tags: Predictions

New platforms, new technologies and new risks! Here are my predictions for 2024 in relation to development. Nothing in this article is guaranteed to happen, but I rank them as very likely.

Running a Rust kernel on JupyterLab Desktop

Posted on 2023-12-29, by Racum. Tags: Rust Jupyter

If you want to combine the power of Rust with the free-style research orientation of Jupyter notebooks, try using the Rust kernel on it; this allows for an easy prospective approach, making it very similar to Python.

Converting projections on Shapely

Posted on 2023-12-24, by Racum. Tags: GIS Python GeoJSON

Sometimes when dealing with coordinates, you may need to work in meters instead of degrees, but, since we don’t live in a flat earth, the calculation is not trivial. Thankfully, there are tools to help with the conversions.

OpenStreetMap to GeoJSON

Posted on 2023-12-19, by Racum. Tags: GIS OpenStreetMap GeoJSON JSON

Use OpenStreetMap as your repository of geometries, and export them in the more convenient GeoJSON format. This technique only works with geometries with area (Polygon and MultiPolygon), points and lines break the exporting tool used here.

JSON command-line toolbox (jq, gron, jc, etc)

Posted on 2023-12-12, by Racum. Tags: JSON Tools

The JSON format is the backbone of current Internet protocols and APIs, and this article contains a list of tools to make a better use of it from the command-line, without the need of writing complex programs to read, search, parse, transform and transmit JSON data.