All Projects → yazeed44 → gjf

yazeed44 / gjf

Licence: MIT license
A tool in Python to fix invalid GeoJSON objects and files

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to gjf

Mapboxstatic.swift
Static map snapshots with overlays in Swift or Objective-C on iOS, macOS, tvOS, and watchOS
Stars: ✭ 162 (+72.34%)
Mutual labels:  geojson
Qgis Latlontools Plugin
QGIS tools to capture and zoom to coordinates using decimal, DMS, WKT, GeoJSON, MGRS, UTM, and Plus Codes notation. Provides external map support, MGRS & Plus Codes conversion and point digitizing tools.
Stars: ✭ 213 (+126.6%)
Mutual labels:  geojson
echarty
Minimal R/Shiny Interface to ECharts.js
Stars: ✭ 49 (-47.87%)
Mutual labels:  geojson
Mapshaper Plus
Generate geojson files for Echarts Map,base on mapshaper(Echarts 地图数据压缩转换)
Stars: ✭ 163 (+73.4%)
Mutual labels:  geojson
L7
🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis framework which relies on Mapbox GL or AMap to render basemaps.
Stars: ✭ 2,517 (+2577.66%)
Mutual labels:  geojson
Geojson.js
Turn your geo data into GeoJSON. For Node.js and the browser.
Stars: ✭ 223 (+137.23%)
Mutual labels:  geojson
Tippecanoe
Build vector tilesets from large collections of GeoJSON features.
Stars: ✭ 1,986 (+2012.77%)
Mutual labels:  geojson
kandilli-rasathanesi-api
Kandilli rasathanesinin son dakika depremler ve tarihe göre deprem listesi için ara API (last minute earthquakes in turkey)
Stars: ✭ 90 (-4.26%)
Mutual labels:  geojson
Django Geojson
django-geojson is a collection of helpers to (de)serialize (Geo)Django objects into GeoJSON.
Stars: ✭ 209 (+122.34%)
Mutual labels:  geojson
Php Crud Api
Single file PHP script that adds a REST API to a SQL database
Stars: ✭ 2,904 (+2989.36%)
Mutual labels:  geojson
Japancitygeojson
GeoJson of Japanese cities. and TopoJson.
Stars: ✭ 164 (+74.47%)
Mutual labels:  geojson
Go.geojson
Encoding and decoding GeoJSON <-> Go
Stars: ✭ 172 (+82.98%)
Mutual labels:  geojson
Mapshaper
Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
Stars: ✭ 2,813 (+2892.55%)
Mutual labels:  geojson
Rgeo Geojson
RGeo component for reading and writing GeoJSON
Stars: ✭ 162 (+72.34%)
Mutual labels:  geojson
geojsoncontour
Convert matplotlib contour plots to geojson
Stars: ✭ 78 (-17.02%)
Mutual labels:  geojson
Gcoord
地理坐标系转换工具
Stars: ✭ 2,206 (+2246.81%)
Mutual labels:  geojson
Rgm
Tiny (1kb less) but very powerful React Google Map
Stars: ✭ 221 (+135.11%)
Mutual labels:  geojson
cogj-spec
Cloud Optimized GeoJSON spec
Stars: ✭ 36 (-61.7%)
Mutual labels:  geojson
geojson-editor
A modified version of Googles Simple GeoJSON Editor
Stars: ✭ 43 (-54.26%)
Mutual labels:  geojson
Mapstore2
Modern webmapping with OpenLayers, Leaflet and React
Stars: ✭ 251 (+167.02%)
Mutual labels:  geojson

gjf: A tool for fixing invalid GeoJSON objects

The goal of this tool is to make it as easy as possible to fix invalid GeoJSON objects through Python or Command Line.

Installation

pip install gjf

Verify installation by running

gjf --version

Features

  • Fix all types of GeoJSON objects, including FeatureCollection and Geometry Collection. If there is nothing to fix the object will be returned as is.
  • Can validate GeoJSON objects, and print explanations if the object is not valid.
  • Can be used within Python or command line

Usage

Python

Say, you have a GeoJSON object defined as follows:

obj = {"type":"Polygon","coordinates":[[[45.892166,25.697688],[45.894522,25.696483],[45.897131,25.695144],[45.898814,25.694268],[45.900496,25.693394],[45.901284,25.692983],[45.903946,25.697312],[45.894791,25.701933],[45.894621,25.701657],[45.892593,25.698379],[45.892166,25.697688]],[[45.892086,25.697729],[45.892166,25.697688],[45.892086,25.697729]]]}

You can simply call apply_fixes_if_needed

from gjf.geojson_fixer import apply_fixes_if_needed

fixed_obj = apply_fixes_if_needed(obj)

You can also flip coordinates order by toggling flip_coords

from gjf.geojson_fixer import apply_fixes_if_needed

fixed_obj_with_flipped_coordinates = apply_fixes_if_needed(obj, flip_coords=True)

You can also check whether a GeoJSON object is valid or not by calling validity

from gjf.geojson_fixer import validity
validity(obj)

Will result ('invalid', ['Too few points in geometry component[45.892086 25.697729]', ''])

CLI

gjf invalid.geojson

gjf will fix the file, and output to invalid_fixed.geojson by default. If you need the output directed in another way you can use --output-method as directed below. It is also possible to fix multiple files, as below.

gjf invalid_1.geojson invalid_2.geojson

Above will output fixed GeoJSON objects to invalid_1_fixed.geojson and invalid_2_fixed.geojson.

CLI Arguments

  • --version print version and exit
  • --validate validate GeoJSON file, and print the error message if it is not valid, without attempting to fix it.
  • --flip Flip coordinates order
  • -o, --output-method [overwrite|new_file|print]
    • Default is new_file, where gjf will output fixed GeoJSON object to file with the postfix _fixed. Whereas overwrite will write the fixed GeoJSON object to the source file, overwriting the original file in process. Lastly, print will output the fixed GeoJSON object on the terminal
gjf --output-method print invalid.geojson

This would print fixed invalid.geojson on the terminal

Issues

Feel free to open an issue if you have any problems.

Special Thanks

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].