# Problem with Multiple Lat/Lon fields in a CSV

**URL:** <https://discuss.elastic.co/t/problem-with-multiple-lat-lon-fields-in-a-csv/139066>\
**Category:** Logstash\
**Created:** [July 8, 2018, 8:14pm UTC](https://discuss.elastic.co/t/problem-with-multiple-lat-lon-fields-in-a-csv/139066 "2018-07-08T20:14:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Celtics2018](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@Celtics2018](https://discuss.elastic.co/u/Celtics2018)\
**Post date:** [July 8, 2018, 8:14pm UTC](https://discuss.elastic.co/t/problem-with-multiple-lat-lon-fields-in-a-csv/139066/1 "2018-07-08T20:14:41Z")

</div>

Hello,

I am trying to index a csv data set on Divvy bikeshare ride data. I want to be able to visualize the locations of the bike docks on a map, so both the location of the beginning of the rental and the location of the drop off point of the rental both have Lat/Long fields. i.e.:

```
FromStationID	FromLatitude	FromLongitude	FromStationName	
159 41.9077 -87.685854 Claremont Ave & Hirsch St	

ToStationID	ToLatitude	ToLongitude ToStationName
69 41.90939601	-87.67769193	Damen Ave & Pierce Ave

```

However when loading this into Elasticsearch the second lat/long fields overwrite the first. Here is my config:

```
input {
  file {
    path => "/Users/Celtics/Desktop/63/divvyMaster.csv"
    start_position => "beginning"
    sincedb_path => "/dev/null"
  }
}

filter {
    csv{
      separator => ","
      columns => ["TripID","Date", "StartTime","EndTime","BikeID",
      "TripDuration","FromStationID","FromLatitude",
      "FromLongitude","FromStationName","ToStationID","ToLatitude","ToLongitude","ToStationName","UserType", "Gender", "BirthYear"]

    }
    date {match => ["Date", "yyyy-MM-dd]"]}
    mutate {convert => ["TripID", "integer"]}
    mutate {convert => ["BikeID", "integer"]}
    mutate {convert => ["TripDuration", "integer"]}
    mutate {convert => ["BirthYear", "integer"]}
    mutate {convert => ["FromLatitude", "float"]}
    mutate {convert => ["FromLongitude", "float"]}
    mutate {convert => ["ToLatitude", "float"]}
    mutate {convert => ["ToLongitude", "float"]}

    mutate {rename => ["FromLatitude", "[location][lat]"]}
    mutate {rename => ["FromLongitude", "[location][lon]"]}
    mutate {rename => ["ToLatitude", "[location][lat]"]}
    mutate {rename => ["ToLongitude", "[location][lon]"]}

    

}

output {
  elasticsearch {
    hosts => "localhost"
    index => "divvy"
    document_type => "logs"
  }
  stdout{}
}

```

Does anyone have any insight as to what to do here to separate the two lat/long to be separate?

Thanks!

---

<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:** [July 9, 2018, 2:14am UTC](https://discuss.elastic.co/t/problem-with-multiple-lat-lon-fields-in-a-csv/139066/2 "2018-07-09T02:14:12Z")

</div>

You need to use different field names here;

> [@Celtics2018](#):
>
> mutate {rename =\> ["FromLatitude", "[location][lat]"]}  
> mutate {rename =\> ["FromLongitude", "[location][lon]"]}  
> mutate {rename =\> ["ToLatitude", "[location][lat]"]}  
> mutate {rename =\> ["ToLongitude", "[location][lon]"]}

Maybe `[from_location][lat]`, or similar.  
As is it now, you just overwrite the `From` values.

> [@Celtics2018](#):
>
> document\_type =\> "logs"

I would suggest not doing that, just use the default.

---

<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:** [August 6, 2018, 2:21am UTC](https://discuss.elastic.co/t/problem-with-multiple-lat-lon-fields-in-a-csv/139066/3 "2018-08-06T02:21:50Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
