Geokit-node is a command-line interface (CLI) tool written in node. Geokit is installed with docker, due several functionalities from other repositories like awesome-geojson were incorporated to Geokit functionalities.
- Building from repo
git clone [email protected]:developmentseed/geokit.git
cd geokit/
docker-compose build
alias geokit='docker run --rm -v ${PWD}:/mnt/data developmentseed/geokit:node.latest geokit'
- Building from docker-hub
alias geokit='docker run --rm -v ${PWD}:/mnt/data developmentseed/geokit:node.latest geokit'
docker-compose run geokit
or
cd geokit/
docker run --rm -v ${PWD}:/mnt/data developmentseed/geokit:node.latest bash
- Gets the total area in km² of polygon features that there are in a geojson file.
geokit area input.geojson
- Gets the bbox of a FeatureCollection.
geokit bbox input.geojson
- Converts a bbox to FeatureCollection.
geokit bbox2fc --bbox="0, 0, 10, 10" > output.geojson
- Creates features' buffer for a given radius.
geokit buffer input.geojson --unit=meters --radius=10000 > output.geojson
- Creates features' square for a given radius in meters, in case of Polygon and LineString the script takes the centroid to generate the square
geokit fc2square input.geojson --radius=40 > output.geojson
- Gets the total distance in km of LineString and MultiLineString features that there are in a geojson file.
geokit distance input.geojson
- Changes the type of geometry from LineString to Polygon.
geokit line2polygon input.geojson > output.geojson
- Sets each feature into a row from FeatureCollection.
geokit fc2frows input.geojson > output.json
- Adds an osm_download_link column per each feature and each link downloads the feature in JOSM.
geokit fc2csv input.geojson > output.csv
geokit addattributefc input.geojson --prop "type=hospital" > output.geojson
- Filters features by given property and it will generate a new geojson file with the filtered features.
geokit filterbyprop input.geojson --prop building=* > output.geojson
- Filters features by given one or many geometry types and it will generate a new geojson file with the filtered features.
<geometry_types>: Could be Polygon, LineString, etc.
geokit filterbygeometry input.geojson --geos <geometry_types> > ouput.geojson
- Gets the total number of features that exist inside the a geojson file (according to a chosen property).
geokit countfeature input.geojson --prop building=*
- Gets the area in m² of each feature (polygon) into a geojson file and it will generate a new geojson file with all features plus an area property.
geokit featurearea input.geojson > output.geojson
geokit featurebbox input.geojson > output.geojson
geokit featuredistance input.geojson > output.geojson
- Counts features larger than the given area size in km². Applicable for polygons.
geokit countbysize input.geojson --psize=1000
- Gets the difference of the objects between two geojson files according to a common attribute.
--key: Could be any of attribute, which is in both files.
geokit difference <file1.geojson> <file2.geojson> --key=school_code
geokit keepattributes <file1.geojson> --keys="id,power,timestamp" > output.geojson
geokit renamekey <file1.geojson> --key="idBuilding>id" > output.geojson
- Gets the duplicate objects, identified by a unique attribute or primary key.
geokit duplicatefeatures <file1.geojson> --key=id
- Pass a geojson with points and get the nearest tiles to this point in a geojson file.
geokit point2tile <file.geojson> --zoom=17 --buffer=0.2 --copyattrs=true > tiles.geojson
- Pass a polygon and get the tiles which cover all the polygon at a certain zoom. From: https://github.com/mapbox/tile-cover
geokit tilecover polygon.geojson --zoom=15 > tiles.geojson
- Deletes the attributes that have a null value.
geokit deletenulls input.geojson > output.geojson
- Gets a geojson file from json file.
geokit jsonlines2geojson input.json > output.geojson
- Gets the centroid for each features.
geokit centroid input.geojson > output.geojson
- Divides the features into a geojson file according to a given zoom level (works for zoom <= 15), and it will generate geojson files into a folder.
geokit splitbyzoom input.geojson --folder=foldername --zoom=10
Functionalities outside Geokit into a Docker image.
- Converts osm file to geojson format.
osmtogeojson input.osm > output.geojson
- Converts geojson file to osm format.
geojsontoosm input.geojson > output.osm
- Converts geojson polygons to OpenStreetMap (OSM) poly format file.
geojson2poly input.geojson output.poly
- Removes all but specified properties from features in a geojson FeatureCollection.
geojson-pick PROPERTYNAME1 < input.geojson > output.geojson