Coder Social home page Coder Social logo

donomii / osm2geojson Goto Github PK

View Code? Open in Web Editor NEW
3.0 2.0 2.0 32 KB

Converts Open Street Map osm files into geojson

Home Page: https://donomii.github.io/osm2geojson

License: GNU General Public License v3.0

Go 100.00%
geojson osm openstreetmap openstreetmaps xml map maps mapping converter converts osm2geojson osm-files streams stream

osm2geojson's Introduction

Build Status

osm2geojson

Converts Open Street Map osm files into geojson, or optionally "one feature per line" format

Works on osm files or streams, allowing it to process files directly from the network, without downloading them first.

To do

Note osm2geojson currently extracts only points. More complicated structures are not implemented yet.

To install

go get github.com/donomii/osm2geojson
go install github.com/donomii/osm2geojson

To use

As a stream processor

cat europe.osm | ./osm2geojson

type europe.osm | osm2geojson

Converting directly from the internet

wget -q -O - http://download.geofabrik.de/antarctica-latest.osm.bz2 | bunzip2  | ./osm2geojson

or you can use the --compression flag to use the internal decompressor

wget -q -O - http://download.geofabrik.de/antarctica-latest.osm.bz2 |  ./osm2geojson --compression bz2

Read from file, write to stdout

./osm2geojson europe.osm.bz2

osm2geojson europe.osm.bz2 

Read from file, write to file

./osm2geojson europe.osm.bz2 europe.geojson.gz

osm2geojson europe.osm.bz2 europe.geojson.gz

Read from stdin, write to file

./osm2geojson - europe.geojson.gz

osm2geojson - europe.geojson.gz

Correct geojson format

By default, osm2geojson prints each feature on a new line, so you can use command line tools like GREP and AWK to filter the results. e.g. to get every mountain in Europe:

./osm2geojson europe.osm.bz2 | grep -i mountain

However this is not correct geojson. To get correct geojson, add --strict to your command.

./osm2geojson --strict europe.osm.bz2

Note that correct geojson is all on one line, so you can no longer use command line tools.

Author

Adapted from http://fabsk.eu/misc/osmxml.go

Now maintained by Donomii

osm2geojson's People

Contributors

berkes avatar donomii avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

osm2geojson's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.