How set visible labels with high tilt?

69 views
Skip to first unread message

Александр Тищенко

unread,
May 11, 2021, 3:09:35 PM5/11/21
to Mapsforge & VTM
Hi. I have app on Android with http tile source. When it render with tilt about 65 the farplane labels sets invisible. How can I fix it? Please help. Thanks.

Emux

unread,
May 12, 2021, 1:58:25 AM5/12/21
to mapsfo...@googlegroups.com
Do you use VTM OpenGL map library?

What http tile source, does it have vector tiles?

This is how the map tilt works, the remote elements become smaller and smaller
and in the distant horizon the rendering stops.

You can limit the tilt to sane values, like 60-65 degrees.

--
Emux

Александр Тищенко

unread,
May 12, 2021, 3:22:24 AM5/12/21
to Mapsforge & VTM
Yes? I use mapsforge-vtm.

I use json tile source like GeojsonTileSource.

I use tilt with 60-65 degrees. I want see house numbers and street's names on more distance. They are visible just more than 50% of display.



среда, 12 мая 2021 г. в 08:58:25 UTC+3, Emux:

Emux

unread,
May 12, 2021, 3:38:20 AM5/12/21
to mapsfo...@googlegroups.com
This is how map tilt works (see FHD image).

Using very large resolutions (> FHD) or extreme tilts, the horizon cannot be filled.

You can use smaller tilt (50-60) to fill the whole map with labels.

--
Emux
VTM.png

Александр Тищенко

unread,
May 12, 2021, 3:56:57 AM5/12/21
to Mapsforge & VTM
And no way to change it?

среда, 12 мая 2021 г. в 10:38:20 UTC+3, Emux:

Emux

unread,
May 12, 2021, 3:59:30 AM5/12/21
to mapsfo...@googlegroups.com
You can study the code to see if this is possible.

However, this must be optional, as we can not break the library performance by rendering labels over long distances.

--
Emux

Александр Тищенко

unread,
May 12, 2021, 4:34:44 AM5/12/21
to Mapsforge & VTM
Thank you. As I understand it is impossible(

/**
* Height and width in pixels
*/
protected float mHeight, mWidth;

public static final float VIEW_DISTANCE = 3.0f;
public static final float VIEW_NEAR = 1;
public static final float VIEW_FAR = 8;
/**
* scale map plane at VIEW_DISTANCE to near plane
*/
public static final float VIEW_SCALE = (VIEW_NEAR / VIEW_DISTANCE) * 0.5f;

среда, 12 мая 2021 г. в 10:59:30 UTC+3, Emux:

Emux

unread,
May 12, 2021, 4:38:03 AM5/12/21
to mapsfo...@googlegroups.com
If the "final" solves your problem, we can remove them.

But have you tested it with your own VTM clone and it really solves it?

What values have you used?

--
Emux

Александр Тищенко

unread,
May 12, 2021, 4:49:14 AM5/12/21
to Mapsforge & VTM
Not yet. I'll write when it will be done.

среда, 12 мая 2021 г. в 11:38:03 UTC+3, Emux:

Александр Тищенко

unread,
May 14, 2021, 10:24:29 AM5/14/21
to Mapsforge & VTM
Hi. I tested my solution on 3 devices with different API (23, 25, 30) and different resolution. I've had no any problem.

I've made coefficient in org.oscim.utils.Parameters fot editable it:

/**
* Distance coefficient for drawing labels
*/
public static float DISTANCES_LABELS_COEFFICIENT = 3
;

In org.oscim.layers.tile.vector.labeling.LabelPlacement edit function that get mSquareRadius:

float mw = mMap.getWidth();
float mh = mMap.getHeight();

float k = Parameters.DISTANCES_LABELS_COEFFICIENT  * pos.tilt / Viewport.MAX_TILT;
if (k < 0.5) k = 0.5F;

mSquareRadius = (mw * mw + mh * mh) * k;

It let minimise load according tilt's degree

среда, 12 мая 2021 г. в 11:49:14 UTC+3, Александр Тищенко:

Emux

unread,
May 14, 2021, 10:45:16 AM5/14/21
to mapsfo...@googlegroups.com
If you would like to provide a pull request, we would need:

- A boolean in Parameters, so this is optional and original code remains default

- The COEFFICIENT can be in LabelPlacement
  Or it is the same as Viewport.VIEW_DISTANCE ?

- Better use mMap.viewport().getMaxTilt()

--
Emux

Александр Тищенко

unread,
May 14, 2021, 11:07:49 AM5/14/21
to Mapsforge & VTM
- A boolean in Parameters, so this is optional and original code remains default

If you don't want make parameter in Parameters and want take it for all this is not needs. I offer it for editable coefficient.

- The COEFFICIENT can be in LabelPlacement
  Or it is the same as Viewport.VIEW_DISTANCE ?

No, it absolutely different things. Coefficient can be in LabelPlacement

пятница, 14 мая 2021 г. в 17:45:16 UTC+3, Emux:

Emux

unread,
May 14, 2021, 11:13:06 AM5/14/21
to mapsfo...@googlegroups.com
I cannot understand what you mean.

You propose a core change. This must be optional (via Parameters) to be tested thoroughly and not break user apps.

--
Emux

Александр Тищенко

unread,
May 14, 2021, 11:16:00 AM5/14/21
to Mapsforge & VTM
Ok, I understand.

What anything else must I do?

пятница, 14 мая 2021 г. в 18:13:06 UTC+3, Emux:

Emux

unread,
May 14, 2021, 11:17:17 AM5/14/21
to mapsfo...@googlegroups.com
I described above the process.

You can post a pull request and I will review / improve it before merging.

--
Emux

Александр Тищенко

unread,
May 14, 2021, 11:21:05 AM5/14/21
to Mapsforge & VTM
ok, thank you!

пятница, 14 мая 2021 г. в 18:17:17 UTC+3, Emux:

Александр Тищенко

unread,
May 17, 2021, 8:35:34 AM5/17/21
to Mapsforge & VTM
I've changed code but can't pushed my new branch

remote: Permission to mapsforge/vtm.git denied to blakfast

пятница, 14 мая 2021 г. в 18:21:05 UTC+3, Александр Тищенко:

Emux

unread,
May 17, 2021, 8:43:42 AM5/17/21
to mapsfo...@googlegroups.com
Only the administrator can write directly on upstream code.

You need to fork the repository, create a new branch, change the code and create a pull request.

See the GitHub documentation for more details.

--
Emux

Александр Тищенко

unread,
May 17, 2021, 10:06:05 AM5/17/21
to Mapsforge & VTM
All done. Thank you for your help!

понедельник, 17 мая 2021 г. в 15:43:42 UTC+3, Emux:

Emux

unread,
May 18, 2021, 2:56:20 AM5/18/21
to mapsfo...@googlegroups.com
Thanks for the contribution!

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