Search code examples
postgresqlazurepostgisazure-data-factory

Is it possible to copy GeoJson data into PostGIS with Azure Data Factory?


I am looking if it is possible to transition from Airflow to Azure Data Factory. I have a REST API from which I extract GeoJSON and would like to export this to a Postgres Database with PostGIS. I tried to do this with the Copy Data activity, but this only provides a simple mapping between the GeoJSON fields and similar fields in my table. Normally I would use ogr2ogr to do this, but am not sure how to approach this with Azure Data Factory.

Does anyone know if my use case would be possible? If yes, how would you suggest to do it?


Solution

  • I fixed my own question. I created an Azure Function which runs Python in a self assigned docker container (one of the options in Azure Functions). I installed gdal in the standard Azure Functions Python Docker container and run subprocess.run() to execute ogr2ogr with the parameters I pass to it via the body of the Azure Functions POST request. I can run this Azure Function via Azure Data Factory.

    Hope this can help anyone else searching for a similar approach.