Skip to content

Different GeoPosition values for OnTouch and OnClick #417

@JACochran

Description

@JACochran

Email received:

In our pluggable map MapClickedListener there are 2 methods that are called when clicking on the map. The first is an onTouch listener that will respond to the first touch of the screen regardless of event type (singe, double, long, drag, etc). This means this method is always called when the map is clicked. In the case of long press onTouch is called followed by the MapUserInteractionEvent. I took data on a single click with the mouse pointer and then on the same location a long press. Here is an example of the results.

A single click from the on touch method
On Touch: LatLonPoint[lat=34.765178249375595,lon=-86.41371591023108]
On Touch x,y: Point(815, 189)
on Event Single Press: LatLonPoint[lat=34.76517061862333,lon=-86.41370651566413]

A long press
On Touch: LatLonPoint[lat=34.69682246526478,lon=-86.56669172935936]
MapClickedListener: On Touch x,y: Point(624, 287)
on Event Long Press: LatLonPoint[lat=34.69638638712407,lon=-86.56609375423172]
On Long Press x,y: Point(624, 287)

On Touch: LatLonPoint[lat=34.765178249375595,lon=-86.41371591023108]
On Touch x,y: Point(815, 189)
on Event Long Press: LatLonPoint[lat=34.76517061862333,lon=-86.41370651566413]
On Long Press x,y: Point(815, 189)

Distance between touch and long press: 1.2068360080193425

Included at the end is the distance in meters of how far apart these locations are. Zooming out give a larger error and zooming in averaged about .1 m in distance between touch and long press.

I also tried a few times starting around the equator and long pressing further away. Distance between the onTouch calculation and the long press varried any where from about 1200m to 3800m with no relation to how far from the equator I was. This was zoomed way out to see large changes in the data set. I did a small set zoomed in to 2500m and moving away from the equator. Those numbers ended up pretty close to each other.

Log info
50000m zoom
[SINGLE TOUCH TO THE MAP]
MapClickedListener: On Touch: LatLonPoint[lat=34.69682246526478,lon=-86.56669172935936]
MapClickedListener: On Touch x,y: Point(624, 287)
PickNavigateController: ACTION_UP evt NOT dragging. Picks 0.
MapClickedListener: ClickType: CLICKED
MapClickedListener: on Event Single Press: LatLonPoint[lat=34.69638638712407,lon=-86.56609375423172]
[LONG PRESS TO THE MAP]
MapClickedListener: On Touch: LatLonPoint[lat=34.69682246526478,lon=-86.56669172935936]
MapClickedListener: On Touch x,y: Point(624, 287)
PickNavigateController: Long Press 0
MapClickedListener: ClickType: LONG_PRESS
MapClickedListener: on Event Long Press: LatLonPoint[lat=34.69638638712407,lon=-86.56609375423172]
MapClickedListener: Distance between touch and long press: 73.07587954789241
MapClickedListener: On Long Press x,y: Point(624, 287)

10m zoom
[SINGLE TOUCH TO THE MAP]
MapClickedListener: On Touch: LatLonPoint[lat=34.68413190998026,lon=-86.6487055783966]
MapClickedListener: On Touch x,y: Point(554, 350)
PickNavigateController: ACTION_UP evt NOT dragging. Picks 0.
MapClickedListener: ClickType: CLICKED
MapClickedListener: on Event Single Press: LatLonPoint[lat=34.684131887719715,lon=-86.6487055025367]

[LONG PRESS TO THE MAP]
MapClickedListener: On Touch: LatLonPoint[lat=34.68413190998026,lon=-86.6487055783966]
MapClickedListener: On Touch x,y: Point(554, 350)
PickNavigateController: Long Press 0
MapClickedListener: ClickType: LONG_PRESS
MapClickedListener: on Event Long Press: LatLonPoint[lat=34.684131887719715,lon=-86.6487055025367]
MapClickedListener: Distance between touch and long press: 0.0073648950868234085
MapClickedListener: On Long Press x,y: Point(554, 350)
System.out: Got a long press at latitude: 34.684131887719715 Longitude: -86.6487055025367

1000m zoom
[SINGLE TOUCH TO THE MAP]
MapClickedListener: On Touch: LatLonPoint[lat=34.765178249375595,lon=-86.41371591023108]
MapClickedListener: On Touch x,y: Point(815, 189)
PickNavigateController: ACTION_UP evt NOT dragging. Picks 0.
MapClickedListener: ClickType: CLICKED
MapClickedListener: on Event Single Press: LatLonPoint[lat=34.76517061862333,lon=-86.41370651566413]

[LONG PRESS TO THE MAP]
MapClickedListener: On Touch: LatLonPoint[lat=34.765178249375595,lon=-86.41371591023108]
MapClickedListener: On Touch x,y: Point(815, 189)
PickNavigateController: Long Press 0
MapClickedListener: ClickType: LONG_PRESS
MapClickedListener: on Event Long Press: LatLonPoint[lat=34.76517061862333,lon=-86.41370651566413]
MapClickedListener: Distance between touch and long press: 1.2068360080193425
MapClickedListener: On Long Press x,y: Point(815, 189)
System.out: Got a long press at latitude: 34.76517061862333 Longitude: -86.41370651566413

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions