Morgan Herlocker answered in another question, that he uses turf.js
on his desktop with node.js
.
I'm really new to GIS and won't become pro for all hacks. My need is:
- having a geojson with a polygon – I got it
- add a buffer of 5km to that geojson-plygon – well, my problem
- having again a geojson with only the buffer – the result from 2
- add the geojson-buffer to a OpenStreetMap – I got it
I only use buffer and all operations are the same every time. That is why I do not have to step in deep.
This is what happens after the script-way:
It remains a problem of epsg:3857
or epsg:4326
The result is imported to OpenStreetMap.
Best Answer
Since you are a beginner at Node, I'll try to give you a step by step answer
Firstly you need to install Node on your system. The exact steps will depend on your Operating system, and version, but it's a good bet that you will find the installer at https://nodejs.org/download/ You should also note that if you have an updated installer, then NPM or the Node Package Manager will also be installed for you.
Now you need to install turf on your system. The Node way of doing this, is to create a folder, and then install the library inside that folder, so that you can work inside that folder. Open the Node.js command prompt (if you are on windows), and go to your working directory. Then type
npm install turf
. This command will download the required files (turf as well as dependencies) from the internet, and install it your working directory.Now that you have installed the library, you will want to use it. Generally speaking, Node modules & libraries do not have any UI of their own. You call them in your own Nodejs scripts.
You want to buffer and get the buffered output as GeoJSON. Here is an example script that buffers a polygon, and writes the output as a GeoJSON file