Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: integrate tilesets-cli with GDAL/OGR tools #153

Open
tjukanovt opened this issue Mar 31, 2022 · 2 comments
Open

Feature request: integrate tilesets-cli with GDAL/OGR tools #153

tjukanovt opened this issue Mar 31, 2022 · 2 comments

Comments

@tjukanovt
Copy link

As a user I would like to be able to upload large datasets directly from different data sources without converting them to GeoJSON. It would be great if I could use a GeoPackage, shapefile, FGDB, SQLite or even PostGIS as the upload data source. GeoJSON is quite inefficient especially with large datasets.

One option might be to integrate the tilesets-cli pipeline with ogr2ogr, which is an open source ETL CLI tool for converting data, supporting a huge number of vector datasets out of the box.

@mapsam
Copy link
Contributor

mapsam commented Apr 6, 2023

@tjukanovt I agree it'd be nice to use ogr2ogr right out of the box! But it gets a little tricky when delivering the gdal binaries in the package, as you can see in the README.md we don't ship GDAL by default because of A) the size and B) the complexity across different environments.

In the meantime, you can still use GDAL-friendly libraries, like Fiona, to pipe directly to the upload-source command. For example, here's me converting the Natural Earth Data countries from Shapefile to line delimited geojson:

fio cat ~/Downloads/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp | tilesets upload-source mapsam ne_110m_countries
{"id": "mapbox://tileset-source/mapsam/ne_110m_countries", "files": 1, "source_size": 970051, "file_size": 970051}

I'd suggest giving Fiona a try. I'm sure the same command is possible with ogr2ogr directly as well.

@mapsam
Copy link
Contributor

mapsam commented Apr 6, 2023

Here's the same command with ogr2ogr

$ ogr2ogr -f GeoJSONSeq /vsistdout/ ~/Downloads/ne_110m_admin_0_countries/ne_110m_admin_0_countries.shp | tilesets upload-source mapsam ne_110m_countries
{"id": "mapbox://tileset-source/mapsam/ne_110m_countries_ogr2ogr", "files": 1, "source_size": 910672, "file_size": 910672}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants