GPS (GeoJSON Processing Script)
| GPS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Author: | giopera | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| License: | Apache License 2.0 (free of charge) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Platform: | Linux | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Status: | Active | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Version: | 1.0.0 (2026-09-21) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Language: | English
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Source code: | https://github.com/giopera/gps giopera/gps | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Programming language: | Python | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Simple script language to effect tag manipulation on geoJSON files | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
The GPS (abbr. GeoJSON Processing Script or GioPera Script) is a custom scripting language to use to process and edit GeoJSON files in a simple way, useful to distribute and send to other people simple instruction for imports and similar.
While it may not be the best way to implement and it isn't the most flexible thing it's sufficient to do editing on tags and similar information.
The project was created to operate on OpenAddresses data but was lather converted to a more general and flexible paradigm for further info, like the DBSN imports and similar projects.
Processing
The processing of the instructions is sequential, this means that if we do a rename operation and after that a delete operation the delete operation will need to be on the renamed key and not the original one.
On the main branch there is a sample processing script in python but this guide is meant to be for a general format and not relative to the specific processing program.
The Language
The language operates on names and values which are quoted and symbols that define operations.
First Two Lines
The first to lines of a .gps file are the input and output file paths, this is an optional field and might or might not be present, this statically tells the processing program which file to check.
This two references could be also given to the processing program directly via CLI arguments, but the instructions are there to simplify for new users and for ease of passing the script and unifying the experience between many users.
Renaming keys
To rename a key in the "properties" list we can use the ^ operator, so by writing "city"^"addr:city" we are telling the program to update every field with this new key definition.
This will apply only if the key is present and won't be created if not already present.
Delete
To delete something we use the - operator, by doing this every field, empty or not, will be deleted, the syntax of the command is -"addr:city".
Soft Delete
A soft delete is when we delete only empty or null fields and leave fields with data, we use the syntax similar to the delete with ~"addr:city".
Lowercase
We can use the _ sign to lowercase every letter in the value field, by doing this every letter will be lowercased, the correct syntax is _"name".
Title case
To make every starting letter of a phrase capitalized we can use the §, like with §"name" that will transform streets names like VIALE GENERAL GIARDINO and viale general giardino in Viale General Giardino.
Offsetting coordinates
By using +x, +y, -x and -y we can modify the coordinates of the geometry field and offset the coordinates, so by using a syntax similar to +x"0.001".
Concatenate Fields
To join or concatenate two fields in the "property" field, we use it as "number"+"unit" and this will produce something like 17A or 17B
Separate multiple values
If a set of values is described in a field like a CSV file and you want to create multiple records with this value separated you can use this syntax "unit"[;] indicating in the brackets the separator.
Unique geographic coordinates
To use unique geographic coordinates to prevent software like JOSM to create joint nodes you can use the # char and the script will aply an offset when a coordinate is already used.
Conditional statements
To apply a statement based on a condition you can use the : and a syntax like this "number % 2 == 0":+x"0.00001".
To simply put it before the : we have the condition, evaluated based on python syntax and with values replaced by the contents of the feature.