# Geo\_point: adding a field from other fields gets wrong values

**URL:** <https://discuss.elastic.co/t/geo-point-adding-a-field-from-other-fields-gets-wrong-values/45443>\
**Category:** Logstash\
**Created:** [March 25, 2016, 1:02pm UTC](https://discuss.elastic.co/t/geo-point-adding-a-field-from-other-fields-gets-wrong-values/45443 "2016-03-25T13:02:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sen](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sen](https://discuss.elastic.co/u/sen)\
**Post date:** [March 25, 2016, 1:02pm UTC](https://discuss.elastic.co/t/geo-point-adding-a-field-from-other-fields-gets-wrong-values/45443/1 "2016-03-25T13:02:33Z")

</div>

Hello everyone,

In my configuration file in logstash **i want to add a field from other fields** in order to get their values in order to use tilemap on kibana. I achieved to create this field and to convert it as a geo\_point. However, **this field doesn't have the right value**. Here is what i did:

_I am treating as an input a json file where I have gps coordinates of devices. The format of my file is as follows:_  
{  
"server": {  
"longitude": 56.8605769,  
"latitude": 12.181989,  
}  
}

_When I run logstash I get from the previous json file the following fields: **server.latitude** and **server.longitude** _

_I want to display those coordinates, that why i used the following configuration file in logstash:_  
input {  
stdin { }  
file {  
path =\> ["path/to/tata.json"]  
type =\> "myclientdata"  
codec =\> "json"  
start\_position =\> "beginning"  
}  
}  
filter {  
mutate {  
#add\_field =\> ["[location][lat]", "56.8605769"] ( **with thoses values it works** )  
#add\_field =\> ["[location][lon]", "12.181989"]  
add\_field =\> ["[location][lon]", "%{server.longitude}"] #( **with thoses fields it does not work !!** )  
add\_field =\> ["[location][lat]", "%{server.latitude}"]  
}  
mutate {  
convert =\> {  
"[location][lat]" =\> "float"  
"[location][lon]" =\> "float"  
}  
}  
}  
output {  
elasticsearch {  
hosts =\> ["localhost:9200"]  
index =\> "myclientdata"  
}  
stdout { codec =\> rubydebug }  
}

_I also excute a curl command to tell my server to consider 'location' as a geo\_point and it works._

_But At the end when i display location i have:_  
"location": {  
"lon": 0,  
"lat": 0  
}

So please, do you have an idea how to manipulate my field location in function of server.latitude and server.longitude in order to get the righ values ?

Thanks a lot !!

Sen

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 25, 2016, 1:21pm UTC](https://discuss.elastic.co/t/geo-point-adding-a-field-from-other-fields-gets-wrong-values/45443/2 "2016-03-25T13:21:49Z")

</div>

> add\_field =\> ["[location][lon]", "%{server.longitude}"] #(with thoses fields it does not work !!)

Use `%{[server][longitude]}`.

---

<div class="post-metadata">

**Author:** ![sen](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sen](https://discuss.elastic.co/u/sen)\
**Post date:** [March 25, 2016, 1:33pm UTC](https://discuss.elastic.co/t/geo-point-adding-a-field-from-other-fields-gets-wrong-values/45443/3 "2016-03-25T13:33:38Z")

</div>

Thanks a lot Magnus, it works very well now 😃 !!

---

<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, 5:05am UTC](https://discuss.elastic.co/t/geo-point-adding-a-field-from-other-fields-gets-wrong-values/45443/4 "2017-07-06T05:05:20Z")

</div>


