question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Marker position is inaccurate when zoomed out

See original GitHub issue

Issue Type

  • Question
  • Bug
  • Improvement

Description and/or steps/code to reproduce the problem

Hello. I recently created an app to add housenumbers to OSM quickly. To place housenumbers, you add the housenumber and it displayed as a marker on the OSMdroid map.

Here is an example of what I mean:

housenumber when zoomed in

housenumber when zoomed out

As you can see, when zoomed in the housenumber is below the road. But when zoomed out the housenumber is above the road.

Is this a problem with OSMdroid or is it my code?

Here is the code to add a marker that I have used:


        markerList.add(Marker(map))

        markerList.last().position = GeoPoint(address.latitude, address.longitude)
        markerList.last().icon = ContextCompat.getDrawable(this, R.drawable.address)
        markerList.last().setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM)
        markerList.last().title = address.housenumber

        map.overlays.add(markerList.last())
        Log.i("map", "housenumber marker added")

Environment

Android Studio, built using gradle.

If it’s a bug, version(s) of android this affects:

All

Version of osmdroid the issue relates to:

6.1.8

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
spyhunter99commented, Jan 30, 2021

where in the documentation was it listed to use bottom? The javadocs don’t seem to specify this. The sample applications do use a lot, but that’s because most of the icons are pushpin style points in which the location represented by the icon is the tip of the point, not the center point of the icon.

0reactions
IpswichMappercommented, Feb 25, 2021

“Maybe center would be more sensible default” - I guess you’re right, but now it’s a bit too late, with all the apps that already use osmdroid."

??? Is ANCHOR_BOTTOM the default option? I ddin’t even realise that, and I don’t think it matters. When I first made my app, according the osmdroid wiki you should declare the anchor anyway. What I am talking about here is how to make the wiki clearer so that other users do not face the same issues I did.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom marker wrong position when zooming - Stack Overflow
The problem is that since my custom marker is a circle, and not a pointing arrow (like the default one), when the map...
Read more >
BUG: 3.32 exp Markers positioned incorrectly after a zoom to ...
If you zoom out (but not in), the errant marker disappears and goes back to its proper position. It does not reappear in...
Read more >
React-Leaflet: Marker has wrong position after zoom out
1 Answer 1 ... There is nothing wrong with the marker positioning, it just depends on the way marker icon is defined. Since...
Read more >
Markers change position when the map is zoomed
Whilst this appears to be working fine, when the map is zoomed, the markers appear to shift, sometimes resulting in addresses being located...
Read more >
Custom Marker Position Issue when Zoom In and Out
I created a few custom markers with specific latitude longitude, however, when it is zoomed out, the marker position is not accurate.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found