Marker position is inaccurate when zoomed out
See original GitHub issueIssue 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:
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:
- Created 3 years ago
- Comments:10 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
“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.