# I've sensor that sends X Y coordinates for an Indoor Map I want to Convert X-Y to correspondent geolocation and Plot Coordinates into a Custom Map

**URL:** <https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622>\
**Category:** Kibana\
**Created:** [July 11, 2017, 10:22am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622 "2017-07-11T10:22:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alex\_S](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Alex\_S](https://discuss.elastic.co/u/Alex_S)\
**Post date:** [July 11, 2017, 10:22am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/1 "2017-07-11T10:22:06Z")

</div>

Hello Geeks ,

I've sensors that send X Y coordinates for an Indoor Map , I have successfully managed to  
Build a custom map on kibana using GeoServer , But I'm stuck with the following for more than a month now.

1- Convert X Y Coordinates for this indoor map into correspondent lat and long.

2- Plot the data on the map with the Right Scale and distribution of data.

I don't know if this task is even possible in Kibana , I'd really appreciate you suggestions.

Thanks  
Alex

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [July 11, 2017, 12:16pm UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/2 "2017-07-11T12:16:35Z")

</div>

@Alex_S

> 1- Convert X Y Coordinates for this indoor map into correspondent lat and long.

You'll have to manually convert the x y coordinates on the indoor map into the corresponding latitude and longitude.

> 2- Plot the data on the map with the Right Scale and distribution of data.

Maps, and all visualizations in Kibana, operate on aggregates, so if you're looking to plot individual data point, this isn't currently possible. This [enhancement request](https://github.com/elastic/kibana/issues/4234) is targeted at allowing this if you wouldn't mind reviewing it, commenting or 👍ing it.

Once you have your data stored in geopoints with lat/long, you should be able to visualize the aggregate information on the Tilemap and plug in your own WMS server to provide custom layers.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 11, 2017, 12:51pm UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/3 "2017-07-11T12:51:59Z")

</div>

Are you looking to do something similar to what is described in [this blog post](https://www.elastic.co/blog/operational-analytics-with-elasticsearch-at-elasticon-2017-part-2)?

---

<div class="post-metadata">

**Author:** ![Alex\_S](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Alex\_S](https://discuss.elastic.co/u/Alex_S)\
**Post date:** [July 11, 2017, 4:02pm UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/4 "2017-07-11T16:02:17Z")

</div>

Hi @Christian  
Thanks for you reply

Yes indeed , But do you have any Idea on how I can transform my X -Y Coordinates or pixels  
into Corespondent Lat and long for my Indoor map ?

---

<div class="post-metadata">

**Author:** ![Alex\_S](https://avatars.discourse-cdn.com/v4/letter/a/57b2e6/32.png) [@Alex\_S](https://discuss.elastic.co/u/Alex_S)\
**Post date:** [July 11, 2017, 4:03pm UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/5 "2017-07-11T16:03:41Z")

</div>

Hi @Brandon_Kobel

thanks for your reply

But what do you mean by manually ? , is there is a formula that converts X-Y pixels or coordinates  
into corespondent lat and long ? , What do you suggest ?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 11, 2017, 4:46pm UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/6 "2017-07-11T16:46:59Z")

</div>

Do that conversion when you index the data, e.g. in Logstash.

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 17, 2017, 9:04am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/8 "2017-07-17T09:04:47Z")

</div>

@Christian_Dahlqvist  
How to make the conversion in Logstash?  
Thanks.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2017, 9:06am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/9 "2017-07-17T09:06:38Z")

</div>

I suspect you may need to use a [ruby filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-ruby.html) for this type of conversion. Exactly how the calculation/transformation will need to look like I have no idea about as I do not know your data.

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 17, 2017, 9:09am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/10 "2017-07-17T09:09:09Z")

</div>

The data is about X Y Coordinates for an indoor map

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2017, 9:19am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/11 "2017-07-17T09:19:16Z")

</div>

If you look at the blog post I linked to, coordinates on the map are mapped to lat/long coordinates, and this mapping depends on how you map the image in your custom WMS tile server. There is also a link to an older, but potentially simpler, [blog post](https://www.elastic.co/blog/kibana-and-a-custom-tile-server-for-nhl-data) on a similar topic that may also be useful.

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 17, 2017, 9:23am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/12 "2017-07-17T09:23:03Z")

</div>

I did this blog post before but still stuck at the point of conversion the X Y coordinates into lat /long to plot the data on the custom map which i use

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2017, 9:32am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/13 "2017-07-17T09:32:26Z")

</div>

What is the X/Y range of the map you want to plot on? What is the lat/long range of the map on the WMS server?

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 17, 2017, 9:37am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/14 "2017-07-17T09:37:29Z")

</div>

The map range is  
Width= 2360 pixel  
Height= 718 pixel

lat/long range is  
Min X = -105  
Min Y = -45.025760784097045  
Max X = 104.96748940076955  
Max Y = 45

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2017, 9:39am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/15 "2017-07-17T09:39:16Z")

</div>

What does the coordinates in your events look like? Are they expressed as pixels indicating where they belong on the map?

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 17, 2017, 9:42am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/16 "2017-07-17T09:42:10Z")

</div>

Yes, they are

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 17, 2017, 10:01am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/17 "2017-07-17T10:01:26Z")

</div>

Lets assume the event contains fields `X` (in range 0 to 2360) and `Y` (in range 0 to 718).

Assume the following variables are to be used in the calculation/conversion:

```auto
x_range = 2360
y_range = 718
lat_min = -45.025760784097045
lat_max = 45
long_min = -105
long_max = 104.96748940076955
lat_range = lat_max - lat_min
long_range = long_max - long_min

```

Based on this you need to project the coordinate onto the lat/long space. I think something like this should work, but I have not tested it:

```auto
lat = lat_min + (Y * lat_range / y_range)
long = long_min + (X * long_range / x_range)

```

As I am not a Ruby developer I will leave translating this into a Ruby filter to you.

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 17, 2017, 10:04am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/18 "2017-07-17T10:04:32Z")

</div>

Thanks for your effort. I really appreciate it.

---

<div class="post-metadata">

**Author:** ![Graham\_Humphries](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@Graham\_Humphries](https://discuss.elastic.co/u/Graham_Humphries)\
**Post date:** [July 18, 2017, 8:29pm UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/19 "2017-07-18T20:29:07Z")

</div>

Sounds like you need to apply anaffine transformation. This will shift, rotation and scale of your points. To do this you will need to work out the location of at least one of your xy points as lat long. If you know 2 points you can work out the scale factor.

You then need to work out the orientation of your points relative to the geographic coordinate system.

If you search for affine transformation you should find code to do this.

---

<div class="post-metadata">

**Author:** ![moabbas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/moabbas/32/19231_2.png) [@moabbas](https://discuss.elastic.co/u/moabbas)\
**Post date:** [July 19, 2017, 10:43am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/20 "2017-07-19T10:43:07Z")

</div>

@Graham_Humphries Yes, You are right, it already shifted the location of points on the map. I think because the origin of the map in pixel is top left not the same as the custom map in Geoserver which is the center of the image.  
I will look for affine transformation to see what can i do.  
Thanks for your interest.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [July 19, 2017, 10:48am UTC](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622/21 "2017-07-19T10:48:34Z")

</div>

Your lat long intervals are quite large, so the projection is likely to suffer from distortion. If you mapped it against a much smaller lat/long interval, you may be able to reduce the distortion.

[Next page](https://discuss.elastic.co/t/ive-sensor-that-sends-x-y-coordinates-for-an-indoor-map-i-want-to-convert-x-y-to-correspondent-geolocation-and-plot-coordinates-into-a-custom-map/92622.md?page=2)
