How to use your own Python scripts as APIs in OpenRefine

As Python integration in OpenRefine can be cumbersome, I thought about a way to reuse and maintain more complex scripts. Using the Jupyter Kernel Gateway library, it is possible to run Jupyter notebook cells as local APIs. You can have as many APIs as you like within a single notebook, and all of them can be run simultaneously with a single command. When you make changes to the code in a notebook, simply save it and then kill and restart the service to update the APIs.

In this example notebook, decimal coordinates are transformed to gms (degrees, minutes, seconds) and vice versa. The second transformation showcases the usage of an external web service within these APIs (OpenStreetMap Nominatim).

Bildschirmaufnahme 2024-02-19 um 12.11.26(9)

3 Likes

I wonder if a function decToGMS() would be useful to add to OpenRefine? (internally could probably use some code like this or bits of Apache Sedona libraries)
How many other users have this need?
:+1: if so !

3 Likes

I wonder if a function decToGMS() would be useful to add to OpenRefine?

If you want this, please create a feature request in the issue tracker. It'll just get lost here.

It would probably make sense to bundle some set of geo functions (conversions, great circle distance, etc) together, perhaps in a geo data extension.

Tom

Requested new GEO Extension:
New GEO Extension with commonly needed functions for GIS, geography, etc. ยท Issue #6570 ยท OpenRefine/OpenRefine (github.com)

$100 Bounty added to it from "some friends"

1 Like