by k.renee
Last Updated March 29, 2018 00:22 AM

I need to take an xls file which has multiple columns of data, and a column called coordinates which is a string of coordinates (ex. 147.775364306,-20.49918551,0 147.776402476,-20.500021717,0 147.778202959,-20.5015774579999,0), and convert it to a geojson file. How can I do this easily?

Your coordinates look as though they are in the format x,y,z and are space separated. This is already pretty close to GeoJSON format. Presuming your Excel sheet looks like this:

```
A B C D
|-------|-------|-----------------------------|---------|
1 | data1 | data2 | coordinates | geoJson |
|-------|-------|-----------------------------|---------|
2 | foo | bar | x1,y1,z1 x2,y2,z2, x3,y3,z3 | |
|-------|-------|-----------------------------|---------|
3 | other | line | xa,ya,za xb,yb,zb, xc,yc,zc | |
|-------|-------|-----------------------------|---------|
```

You could easily use the following Excel function to create a column of GeoJSON compatible points under the "geoJSON" heading above (cell D2):

```
=CONCATENATE("{ 'type':'LineString','coordinates':[[",SUBSTITUTE(C2, " ", "],["), "]]}")
```

This will give you the result

```
{ 'type':'LineString','coordinates':[[x1,y1,z1],[x2,y2,z2],[x3,y3,z3]]}
```

For each of your rows you will have the GeoJSON representation of the LineString, which you can then save as a file as you please. Please comment if this is not what you are looking for and I will adjust my answer!

- ServerfaultXchanger
- SuperuserXchanger
- UbuntuXchanger
- WebappsXchanger
- WebmastersXchanger
- ProgrammersXchanger
- DbaXchanger
- DrupalXchanger
- WordpressXchanger
- MagentoXchanger
- JoomlaXchanger
- AndroidXchanger
- AppleXchanger
- GameXchanger
- GamingXchanger
- BlenderXchanger
- UxXchanger
- CookingXchanger
- PhotoXchanger
- StatsXchanger
- MathXchanger
- DiyXchanger
- GisXchanger
- TexXchanger
- MetaXchanger
- ElectronicsXchanger
- StackoverflowXchanger
- BitcoinXchanger
- EthereumXcanger