# Create map layer from longitude and latitude

**URL:** <https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002>\
**Category:** Logstash\
**Created:** [October 5, 2020, 1:58pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002 "2020-10-05T13:58:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luca\_Padovan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_padovan/32/76223_2.png) [@Luca\_Padovan](https://discuss.elastic.co/u/Luca_Padovan)\
**Post date:** [October 5, 2020, 1:58pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/1 "2020-10-05T13:58:24Z")

</div>

I want to create a kibana map using two float fields: lat and lon (latitude and longitude), but when i try to create a map in Kibana I can't do it because i don't have a geoip location field. How can i solve it?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 5, 2020, 2:22pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/2 "2020-10-05T14:22:20Z")

</div>

You need a geo\_point field in elasticsearch, you do not need a geoip field. You will need a [template](https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-templates.html) to tell elasticsearch that a field is a geo\_point. The [default](https://github.com/logstash-plugins/logstash-output-elasticsearch/blob/master/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-7x.json) template includes an example of how to do that.

---

<div class="post-metadata">

**Author:** ![Luca\_Padovan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_padovan/32/76223_2.png) [@Luca\_Padovan](https://discuss.elastic.co/u/Luca_Padovan)\
**Post date:** [October 5, 2020, 2:33pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/3 "2020-10-05T14:33:45Z")

</div>

Sorry Badger, but the second link not works.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 5, 2020, 2:36pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/4 "2020-10-05T14:36:53Z")

</div>

Yes, it got renamed to support ecs compatability. I fixed the link. It shows how to create a geo\_ip, but as I said, you only need the part of that which creates a geo\_point.

---

<div class="post-metadata">

**Author:** ![Luca\_Padovan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_padovan/32/76223_2.png) [@Luca\_Padovan](https://discuss.elastic.co/u/Luca_Padovan)\
**Post date:** [October 5, 2020, 3:09pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/5 "2020-10-05T15:09:28Z")

</div>

Sorry but i can't understand. I go to the kibana dev tools and i ran the following request:

```auto
PUT _template/geotemplate
{
  "index_patterns": [
    "alldevices"
  ],
  "settings": {},
  "mappings": {
    "properties": {
      "geoLocation": {
        "type": "geo_point"
      }
    }
  },
  "aliases": {}
}

```

the request goes well, but when i go to the index pattern, i refresh "alldevices" but nothing change, geoLocation is string type.

geoLocation is the field that I have created in the logstash pipeline and it is in the form of lon,lat

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 5, 2020, 3:18pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/6 "2020-10-05T15:18:36Z")

</div>

A mapping will not re-index existing fields. It is only applied when fields are created.

---

<div class="post-metadata">

**Author:** ![Luca\_Padovan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/luca_padovan/32/76223_2.png) [@Luca\_Padovan](https://discuss.elastic.co/u/Luca_Padovan)\
**Post date:** [October 5, 2020, 3:27pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/7 "2020-10-05T15:27:51Z")

</div>

ok, so i have to delete index pattern, launch the request and recreate the index?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [October 5, 2020, 3:39pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/8 "2020-10-05T15:39:34Z")

</div>

That should work, yes.

---

<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:** [November 2, 2020, 3:39pm UTC](https://discuss.elastic.co/t/create-map-layer-from-longitude-and-latitude/251002/9 "2020-11-02T15:39:40Z")

</div>

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