Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to merge Multiple geojson in to one geojson in one FeatureCollection

I have multiple geojson type: FeatureCollection stored in Mysql. I want to merge two or more geojson in to one FeatureCollection geojson and show in my map. I have already leaflet map ready which can easily showing in map.

I read about Mapbox ‘geojson-merge’ but I unable to understand how use api in to my js or PHP file.

https://github.com/mapbox/geojson-merge

I search it for example on web but unable to find any guide about how to use with my online code.

like image 976
Kuntal Parbat Avatar asked Oct 18 '16 07:10

Kuntal Parbat


People also ask

Can you combine GeoJSON files?

This tool can combine two or more GeoJSON files into one merged file. Choose two or more files from your computer and then click "Download merged file" to save the results. The tool only accept valid GeoJSON files with a type of FeatureCollection .


1 Answers

You can use it as a command-line tool.

First, install it:

npm install -g geojson-merge

Then to merge two geojson files run:

geojson-merge one.geojson two.geojson > combined.geojson
like image 176
kmandov Avatar answered Oct 19 '22 23:10

kmandov