# Create map using longitude and latitude coordinates

**URL:** <https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696>\
**Category:** Kibana\
**Created:** [October 22, 2019, 5:17pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696 "2019-10-22T17:17:51Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![computer\_engineer](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@computer\_engineer](https://discuss.elastic.co/u/computer_engineer)\
**Post date:** [October 22, 2019, 5:17pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/1 "2019-10-22T17:17:51Z")

</div>

I have data coming into elastic that contains the longitude, latitude and even altitude points. I would like to have these plotted on a coordinate map in kibana. Search results showed I need to map another field that is of type: geo\_point. I have done that but not sure what is next if the data data is already in elastic and was imported directly into elastic. Some mention the use of a template but I don't understand what to do with it or how.

```
  "mappings" : {
   "_meta" : {
    "created_by" : "ml-file-data-visualizer"
   },
   "properties" : {
    "collection" : {
      "type" : "keyword"
    },
    "created" : {
      "properties" : {
        "$date" : {
          "type" : "long"
        }
      }
    },
    "location" : {
      "type" : "geo_point"
    },
    "mAccuracy" : {
      "type" : "double"
    },
    "mAltitude" : {
      "type" : "double"
    },
    "mBearing" : {
      "type" : "double"
    },
    "mHasAccuracy" : {
      "type" : "boolean"
    },
    "mHasAltitude" : {
      "type" : "boolean"
    },
    "mHasBearing" : {
      "type" : "boolean"
    },
    "mHasSpeed" : {
      "type" : "boolean"
    },
    "mLatitude" : {
      "type" : "double"
    },
    "mLongitude" : {
      "type" : "double"
    },
    "mProvider" : {
      "type" : "keyword"
    },
    "mSpeed" : {
      "type" : "double"
    },
    "mTime" : {
      "properties" : {
        "$date" : {
          "type" : "long"
        }
      }
    },
    "mg_id" : {
      "type" : "keyword"
    },
    "profile_id" : {
      "type" : "keyword"
    },
    "type" : {
      "type" : "keyword"
    },
    "updated" : {
      "properties" : {
        "$date" : {
          "type" : "long"
        }
      }
    }
  }
}

```

}  
}

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [October 22, 2019, 5:35pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/2 "2019-10-22T17:35:51Z")

</div>

It sounds like you have most of the steps figured out.

You need to index the data into an index with a [mapping](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html), and the one you pasted above looks good.

If your data was previously indexed in some other format, you need to reindex using [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) or [update\_by\_query](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html)

---

<div class="post-metadata">

**Author:** ![computer\_engineer](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@computer\_engineer](https://discuss.elastic.co/u/computer_engineer)\
**Post date:** [October 22, 2019, 10:19pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/3 "2019-10-22T22:19:18Z")

</div>

Thanks for responding. I managed to do the reindex and then viewed data in discover to confirm. The new index did not have the field. So my next question is, do I need to send new data to the index that has the field location, with the 2 lat and long values or will the existing mlat and mlong double values be mapped for me.

---

<div class="post-metadata">

**Author:** ![computer\_engineer](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@computer\_engineer](https://discuss.elastic.co/u/computer_engineer)\
**Post date:** [October 22, 2019, 10:34pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/4 "2019-10-22T22:34:44Z")

</div>

Ok so I did everything again and I did resend the data to include a location field. When I try to map the data it say add layer and select source. I select documents but my index does not appear. why?

---

<div class="post-metadata">

**Author:** ![computer\_engineer](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@computer\_engineer](https://discuss.elastic.co/u/computer_engineer)\
**Post date:** [October 22, 2019, 10:39pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/5 "2019-10-22T22:39:39Z")

</div>

Sorry nevermind, refreshed the index pattern and it works. Data surprises me though cause locations are way off.

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [October 23, 2019, 1:21am UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/6 "2019-10-23T01:21:14Z")

</div>

Glad you figured out some of the mapping issues! I'm not sure what would cause locations to be in a place you don't expect- I would recommend opening another thread to ask, and you can include sample documents including sample coordinates

---

<div class="post-metadata">

**Author:** ![computer\_engineer](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@computer\_engineer](https://discuss.elastic.co/u/computer_engineer)\
**Post date:** [October 23, 2019, 1:05pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/7 "2019-10-23T13:05:56Z")

</div>

I actually confirmed the locations in google maps, so the coordinates were correct and the info provided to me on what to expect was not. Thanks for your help.

---

<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 20, 2019, 1:06pm UTC](https://discuss.elastic.co/t/create-map-using-longitude-and-latitude-coordinates/204696/8 "2019-11-20T13:06:04Z")

</div>

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