# Import CSV with Long and Lat

**URL:** https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488
**Category:** Logstash
**Created:** [September 1, 2016, 5:19am UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488 "2016-09-01T05:19:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![amran1](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@amran1](https://discuss.elastic.co/u/amran1)
#### Post date: [September 1, 2016, 5:19am UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488/1 "2016-09-01T05:19:41Z")

</div>

Hello,  
How to show Tile Map with load CSV file include Longitude and Latitude?  
And how to show out each split field in Kibana  
I have write this script, It couldn't run well.

input {  
file {  
path =\> "/tmp/earthquake.csv"  
start\_position =\> "beginning"  
}  
}  
filter{  
csv{  
separator =\> ","  
columns =\> ["DateTime","Latitude","Longitude","Depth","Magnitude","MagType","NbStations","Gap","Distance","RMS","Source","EventID"]  
}

mutate { convert =\> {"Latitude" =\> "float"} }  
mutate { convert =\> {"Longitude" =\> "float"} }  
mutate { rename =\> {"Latitude" =\> "[location][lat]"} }  
mutate { rename =\> {"Longitude" =\> "[location][lon]"} }  
mutate { convert =\> {"[location]" =\> "float" } }  
mutate { convert =\> {"Depth" =\> "float"} }  
mutate { convert =\> {"Magnitude" =\> "float"} }  
mutate { convert =\> {"NbStations" =\> "integer"} }  
}

output{  
elasticsearch {  
hosts =\> "192.168.232.135:9200"  
action =\> "index"  
index =\> "logstash-%{+dd.MM.YYYY}"  
}  
}

Thank you

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 1, 2016, 5:25am UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488/2 "2016-09-01T05:25:18Z")

</div>

Have a look at [https://github.com/kosho/ncedc-earthquakes](https://github.com/kosho/ncedc-earthquakes) and [https://www.elastic.co/blog/earthquake-data-with-the-elastic-stack](https://www.elastic.co/blog/earthquake-data-with-the-elastic-stack)

---

<div class="post-metadata">

### Author: ![amran1](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@amran1](https://discuss.elastic.co/u/amran1)
#### Post date: [September 1, 2016, 9:16am UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488/3 "2016-09-01T09:16:37Z")

</div>

Hello Warkolm,  
I couldn't do this command based on elastic web..

bin/logstash-plugin install logstash-filter-environment

the error:  
hpc@elk:/opt/logstash$ bin/logstash-plugin install logstash-filter-environment  
ERROR: File /opt/logstash/Gemfile does not exist or is not writable, aborting  
hpc@elk:/opt/logstash$

and then

Where I have to run this two bellow commands ?  
tail +1 earthquakes.txt| EVENT="earthquake" logstash/bin/logstash -f ncedc-earthquakes-logstash.conf  
tail +1 blasts.txt| EVENT="blast" logstash/bin/logstash -f ncedc-earthquakes-logstash.conf

Thank you

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 1, 2016, 9:56am UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488/4 "2016-09-01T09:56:53Z")

</div>

If you look in the LS config you will see how to merge lat and lon.

---

<div class="post-metadata">

### Author: ![amran1](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@amran1](https://discuss.elastic.co/u/amran1)
#### Post date: [September 1, 2016, 3:49pm UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488/5 "2016-09-01T15:49:06Z")

</div>

Dear Warkolm,  
Thank you very much for your response..  
I meant I didn't use my first above message script to install anymore, all of the steps I used your both links:

[https://github.com/kosho/ncedc-earthquakes2](https://github.com/kosho/ncedc-earthquakes2) and  
[https://www.elastic.co/blog/earthquake-data-with-the-elastic-stack1](https://www.elastic.co/blog/earthquake-data-with-the-elastic-stack1)

In your documentation has documented that it has to install bin/logstash-plugin install logstash-filter-environment  
but after I run it in the bin/logstash, I found this error:

ERROR: File /opt/logstash/Gemfile does not exist or is not writable, aborting

do you have any solution?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 4:40am UTC](https://discuss.elastic.co/t/import-csv-with-long-and-lat/59488/6 "2017-07-06T04:40:24Z")

</div>


