[VTM][Android] Screen position in pixels

31 views
Skip to first unread message

Jaca

unread,
Feb 7, 2021, 5:05:41 AMFeb 7
to Mapsforge & VTM
Hi,

How to convert geoPoint to screen coordinates having bearing & tilt? I want to draw (on the fly) a lot of custom markers on MapView canvas (dispatchDraw(Canvas canvas)).

Jacek

Emux

unread,
Feb 7, 2021, 5:12:48 AMFeb 7
to mapsfo...@googlegroups.com
You can find such utilities in MercatorProjection class.

--
Emux

Emux

unread,
Feb 7, 2021, 5:19:44 AMFeb 7
to mapsfo...@googlegroups.com
But the markers are set properly on coordinates (and the map rotates / tilt them) - not on pixels.

--
Emux

Jaca

unread,
Feb 7, 2021, 6:11:02 AMFeb 7
to Mapsforge & VTM
But my markers change position and appearance. MercatorProjection.getPixel() doesn't work with rotation.

ps. Google.mapGoogleMap.getProjection().toScreenLocation() works OK. ;-)

Emux

unread,
Feb 7, 2021, 6:13:16 AMFeb 7
to mapsfo...@googlegroups.com
See the marker example in the samples for how to properly add markers on map.

--
Emux

Jaca

unread,
Feb 9, 2021, 7:20:46 AMFeb 9
to Mapsforge & VTM
I tried but update of markers is too slow because everyone has their own (drawn on the fly) bitmap.

Jaca

unread,
Feb 15, 2021, 7:15:02 AMFeb 15
to Mapsforge & VTM
;-)
... I'm optimizing display and I've a question: how to simple show/hide created marker(s) by setVisible(true/false)?

Emux

unread,
Feb 15, 2021, 7:36:17 AMFeb 15
to mapsfo...@googlegroups.com
You can use the setEnabled method on the layer or remove / add the markers in the ItemizedLayer.

--
Emux

Jaca

unread,
Mar 18, 2021, 4:22:10 AMMar 18
to Mapsforge & VTM
Hi Emux, ;-)

I have a problem with the VectorLayer. Could You check why a shape on the VectorLayer doesn't show very often after starting VectorLayerActivity?

Use VectorLayerActivity from examples and:
1. change number of shapes to one
2. increase size of shape
3. change position to fixed GeoPoint(0.0f, 0.0f)
4. run several times...

The map needs to be moved to refresh (and display shape) very often.

Emux

unread,
Mar 18, 2021, 4:31:48 AMMar 18
to mapsfo...@googlegroups.com
Please create new topics for new questions, so that users can search them easier in the future.


> The map needs to be moved to refresh (and display shape) very often.

You need to call the vectorLayer.update() like in the sample.

--
Emux
Reply all
Reply to author
Forward
0 new messages