Convert GeoJSON to BrokJSON and vice versa
Project description
BrokJSON
Ever struggled with huge GeoJSON-Files? BrokJSON is your space-saving alternative! Depending on your data you can save up to 80%. Withouth losing any data! Why? Because it uses the same ideas as GeoJSON.
The idea behind BrokJSON: RAM is mightier than the bandwidth - download the small BrokJSON and convert it on runtime to GeoJSON than loading a huge GeoJSON.
Example
This GeoJSON with just two Points...
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {
"id": 1,
"title": "Datapoint 1",
"value": 343
},
"geometry": {
"type": "Point",
"coordinates": [8.5402,47.3782]
}
},
{
"type": "Feature",
"properties": {
"id": 1,
"title": "Datapoint 2",
"value": 14
},
"geometry": {
"type": "Point",
"coordinates": [8.5637,47.4504]
}
}]
}
... looks as a BrokJSON like this:
{
"properties": ["id", "title", "value"],
"geometries": [{
"type": "Point",
"features": [
[[8.5402, 47.3782], [1, "Datapoint 1", 343]],
[[8.5637, 47.4504], [1, "Datapoint 2", 14]]
]
}
]}
No information lost, everything is there. Amazing!
Installation
pip install brokjson
Usage
# import BrokJSON
import brokjson
# Load your GeoJSON
geojson = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [8.5402,47.3782]
}
}]
}
# Convert your Json-Object to BrokJson
brok = brokjson.geo2brok(geojson);
# "brok" is your BrokJSON as a dictionary object
print(brok)
# Convert it back
geojson = brokjson.brok2geo(brok)
print(geojson)
Documentation
BrokJSON is a lightweight library, there are only two functions.
GeoJSON to BrokJSON
brokjson.geo2brok(geoJsonObject)
Parameters
GeoJSON
as a Dictionary
Return value
BrokJSON
as a Dictionary
BrokJSON to GeoJSON
brokjson.brok2geo(brokJsonObject)
Parameters
BrokJSON
as a Dictionary
Return value
GeoJSON
as a Dictionary
Full Spec and other languages
Have a look at https://www.brokjson.dev
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file brokJSON-1.0.0.tar.gz
.
File metadata
- Download URL: brokJSON-1.0.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0078b509da74f2f8d1a1e72fbbd94ccb38062bdcb1744ea2ff368c376ad43ee9 |
|
MD5 | 792625cc71b02de723c2b523bcfc742e |
|
BLAKE2b-256 | f2147932e04c136606e3746ea7f2ab83bfe6da9ac1a32bf8ea57c50f19d27f7e |
File details
Details for the file brokJSON-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: brokJSON-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e337e10570c7904f1c524ec8b74c519c44a723f91ed072e3d1d00616ad3cca81 |
|
MD5 | f6c00cc13d1cfb7dad1ff6490feb0c93 |
|
BLAKE2b-256 | e1f1938fad9f11f6fb2932d2e985ec25ca99b018b3a0391d06ebc53c9af56b29 |