Skip to content

Python command line application to convert BrokJSON files to GeoJSON files and vice versa

License

Notifications You must be signed in to change notification settings

Kasluk24/brokjson-file-converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brokjson file converter

Python command line application to convert BrokJSON files to GeoJSON files and vice versa

What is BrokJSON?

Installation

Minimal required Python version: 3.4

Get directly from GitHub and install with pip

  • Execute the following command in the command line
    pip install git+https://github.com/Kasluk24/brokjson-file-converter.git#egg=brokjson-file-converter

Manual download and install with pip

  • Download the zip file from GitHub and save it in a directory of your choice
  • Install from the zip file with the following command (replace <brokjson-file-converter.zip> with the path to the downloaded file)
    pip install <brokjson-file-converter.zip>

Manual ussage

  • Download the zip file from GitHub and save it in a directory of your choice
  • Navigate to the file main.py
  • Open the console and run with
    python __main__.py <function> <inpath> <outpath>

Ussage

  • The converter can convert BrokJSON files to GeoJSON files and also GeoJSON files to BrokJSON files. The first argument defines the direction.
    geo2brok = from GeoJSON to BrokJSON, brok2geo = BrokJSON to GeoJSON

Convert single file

  • The second argument defines the file to be converted
  • The third argument is optional and specifies the converted file. If this file is not specified, the converter creates a subfolder (geo2brok or brok2geo depending on the selected direction) and saves the converted file with the original filename in it

Mass conversion

  • To convert all files in a directory with the ending "*.json", just specifie the directory instead of the filename
  • If no export directory is specified, the files are written to a subfolder named "geojson" or "brokjson" depending on the output format

Overwrite / keep files

  • By default, the converter creates a new folder if no export directory or file has been specified and keeps the original files
  • With the flag "-o" or "--overwrite" the original files are overwritten, even if no export directory / file is specified
  • If an export directory or file has been specified, existing files in the directory are overwritten if they have the same name

Examples

  • Convert the GeoJSON file "GeoJSON.json" to the BrokJSON file BrokJSON.json
    python -m brokjson-file-converter geo2brok GeoJSON.json BrokJSON.json
  • Convert the brokJSON file "BrokJSON.json" to the GeoJSON file GeoJSON.json
    python -m brokjson-file-converter brok2geo BrokJSON.json GeoJSON.json
  • Convert all "*.json" files inside the directory "brokfiles" to GeoJSON files into the directory "geofiles"
    python -m brokjson-file-converter brok2geo brokfiles geofiles
  • Convert all "*.json" files inside the directory "geofiles" to BrokJSON files and overwrite the original files
    python -m brokjson-file-converter -o geo2brok geofiles

About

Python command line application to convert BrokJSON files to GeoJSON files and vice versa

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages