# Display geo position of a mouse pointer in a unfolding map

**URL:** <https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655>\
**Category:** Libraries\
**Created:** [April 26, 2019, 9:06am UTC](https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655 "2019-04-26T09:06:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkxxbdm](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kkxxbdm](https://discourse.processing.org/u/kkxxbdm)\
**Post date:** [April 26, 2019, 9:06am UTC](https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655/1 "2019-04-26T09:06:02Z")

</div>

Hi, I have the following code to accomplish a simple task, to display the geo-posiition of a mouse in a map.

```auto
import de.fhpotsdam.unfolding.*;
import de.fhpotsdam.unfolding.geo.*;
import de.fhpotsdam.unfolding.utils.*;

UnfoldingMap map;

void setup() {
  size(800,800);
  map = new UnfoldingMap(this);
  MapUtils.createDefaultEventDispatcher(this,map);
}

void draw() {
  map.draw();
  Location location = map.getLocation(mouseX, mouseY);
  fill(0);
  text(location.getLat() + "," + location.getLon(), mouseX, mouseY);
}

```

I tried this out. Yet, it does not work. I mean, I click a position of the map, yet the latitude and longitude pair do not appear at all.  
I was wondering, does anyone know what might be wrong in the code?

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [April 26, 2019, 10:01am UTC](https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655/2 "2019-04-26T10:01:34Z")

</div>

better use P2D, and you see the GPS coordinates

 ![SNAG-0088](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/ba20053652096b13bc5e7aec62436b9fb7f91798.jpeg)

---

<div class="post-metadata">

**Author:** ![kkxxbdm](https://avatars.discourse-cdn.com/v4/letter/k/b5a626/32.png) [@kkxxbdm](https://discourse.processing.org/u/kkxxbdm)\
**Post date:** [April 26, 2019, 10:23am UTC](https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655/4 "2019-04-26T10:23:13Z")

</div>

What exactly is the meaning of P2D?

---

<div class="post-metadata">

**Author:** ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)\
**Post date:** [April 26, 2019, 10:24am UTC](https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655/5 "2019-04-26T10:24:46Z")

</div>

you not see it in the picture i uploaded?  
that is a test on a Raspberry Pi / Raspbian / processing 3.5.3 / Unfolding Maps 0.9.9beta /  
with your code, mod:

```auto
  size(800,800,P2D);

```

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [April 27, 2019, 8:26am UTC](https://discourse.processing.org/t/display-geo-position-of-a-mouse-pointer-in-a-unfolding-map/10655/6 "2019-04-27T08:26:00Z")

</div>

For render selection, check the [size()](https://processing.org/reference/size_.html) function as it describes available renderers in Processing. As Kll has mentioned before, Unfolding seems to only work with P2D and not the default JAVA2D renderer.

Kf
