Geotrans 0.0.5 | GitLocker.com Product

geotrans 0.0.5

Last updated:

0 purchases

geotrans 0.0.5 Image
geotrans 0.0.5 Images
Add to Cart

Description:

geotrans 0.0.5

Documentation

Published on ReadTheDocs:
Documentation



Features

Command line utility for easy transformations between geodata/spatial
filetypes.
Python functions with documentation for direct usage.

This is my own main use case: A package with all basic geopandas
file loads and saves bundled.


Uses Python pathlib for cross-platform path handling.



Support
Currently supports:

GeoPackages
Esri
Shapefiles
File
Geodatabases
Read only
GeoJSON

All file formats supported by geopandas can be implemented.


Dependencies

geopandas for
transforming between geodata filetypes which in turn uses fiona (that
uses GDAL).
click for command line
integration.



Alternatives
The GDAL tool ogr2ogr is a
much more sophisticated command-line tool for converting between spatial
file formats.
Geopandas by itself supports many more spatial file formats. For more
advanced use cases when interacting with Python I recommend just using
geopandas.
Fiona provides a command-line interface fio.
fio.


Installation

PyPi

pip install geotrans

poetry for development

git clone https://github.com/nialov/geotransform.git
cd geotransform
poetry install


Using geotransform

Command line
Run
geotrans --help
to print the command line help for the utility.
To transform from a geopackage file with a single layer to an ESRI
shapefile:
geotrans input_file.gpkg --to_type shp --output output_file.shp
To transform from a geopackage file with multiple layers to multiple
ESRI shapefiles into a given directory:
geotrans input_file.gpkg --to_type shp --output output_dir


Python
All main functions in charge of loading and saving geodata files are
exposed in the transform.py file in the geotrans package.
from geotrans.transform import load_file, save_files, SHAPEFILE_DRIVER
from pathlib import Path

# Your geodata file
filepath = Path("input_file.gpkg")

# load_file returns a single or multiple geodataframes depending
# on how many layers are in the file.
geodataframes, layer_names = load_file(filepath)

# Assuming geopackage contained only one layer ->
# Save acquired geodataframe and layer
save_files(geodataframes, layer_names, [Path("output_file.shp")], SHAPEFILE_DRIVER)



License

This project is licensed under the terms of the MIT
license.

Copyright © 2020, Nikolas Ovaskainen.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.