Topic: Some problem extending the horizon

Hello,
I'm following your tutorial to create an horizon
https://www.youtube.com/watch?v=qDg1nsN2tp0

I have 2 problems:

1 - it seem that you use Mapbox for the horizon elevation, but I'm using Bing, because Mapbox elevation data are totally wrong (at least in my area).
Is it possible to use Bing elevation instead of Mapbox with Horizon script?

2 - I'm using ArcGIS for map texture (it's the best quality at least in my area), using Horizon script (with Mapbox elevation) when I press Play not only the horizon but also my "main" map get totally blurred, it seem that is "covered" by the blurred one.
What I'm doing wrong?

Many thanks

Re: Some problem extending the horizon

Hello.

1. Theoretically - yes.
Practically - this script was created to work with Mapbox Elevation, and it is much easier to write a new script than to modify this one.
2. Reduce Position Y Offset. For example, set "-15" instead of "-5".

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

3 (edited by danielesuppo 2019-05-20 00:23:18)

Re: Some problem extending the horizon

As you suggested reducing the Y Offset did the trick, but It's so different from Bing elevation that I had to reduce it to -95 (!!).
And, when I increase the map zoom level, the Mapbox horizon overlay again the "standard" map (with Bing elevation), just because it's so much different (Mapbox elevation data seem to be a lot scaled on Y axis).
Since it's really a shame not to be able to extend the horizon (it look way better), I tried again to use Mapbox, instead of Bing, for elevation but

1) with "OnlineMapsMapboxElevationManager" (instead of "OnlineMapsBingMapsElevationManager") I don't receive OnlineMapsElevationManagerBase.OnElevationUpdated" event.

I've subscribed a function in my class to "OnElevationUpdated" in this way:
private void Start()
    {
        OnlineMapsElevationManagerBase.instance.OnElevationUpdated += MyFunction;
    }

but with "OnlineMapsMapboxElevationManager" script I don't get this event (with "OnlineMapsBingMapsElevationManager" I get it).


2) since Mapbox elevation data seem to be wrong, or too scaled, I don't know, at least in my area, I'd really like to be able to use Bing elevation data for the horizon.
I gave a look to Horizon2_OM3 script, but honestly I don't know how to modify it for Bing.
I know that to write a new script is quite an effort, but... any chances to have this script for Bing?
Maybe, could you write me a private message to talk about it?


3) I'm a bit confused how to use Google for elevation data (that, maybe, would be the best solution).
All the Google scripts must derive from Monobehaviour, so... how to use Google for elevation?


Many thanks!

Re: Some problem extending the horizon

1. This script was created in the original for Online Maps v2, where elevations were only from Bing Maps.
So this requires OnlineMapsBingMapsElevationManager.

2. Yes, I will try to write for you a script using Bing Maps.
It will take some time. I think 1-2 weeks.
If you need private support, you can email me (support@infinity-code.com).

3. Google Elevation API cannot return elevations for an area.
Only for line or point.
Encode 1024 points in one request is very inconvenient.
So using Google Elevation API is a bad way.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Some problem extending the horizon

1 - I see
2 - I'm really grateful for it!
3 - I see

Thanks a lot

Re: Some problem extending the horizon

Hello.

Horizon 2 for Bing Maps is attached.

Post's attachments

Attachment icon Horizon2_BingMaps.cs 12.14 kb, 3 downloads since 2019-05-29 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

7 (edited by danielesuppo 2019-06-01 15:41:25)

Re: Some problem extending the horizon

Many thanks!!!!
The only issue is that does not have elevation, and if it's active at Start also the main map does not get elevation

Re: Some problem extending the horizon

Unfortunately, I did not understand what you mean.

https://i.ibb.co/zrjg0G1/img1.png

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Some problem extending the horizon

I have a different behaviour...
(picture in attachment)

Post's attachments

Attachment icon Untitled-1.jpg 313.76 kb, 1 downloads since 2019-06-04 

Re: Some problem extending the horizon

The problem is that you specified the key in Bing Maps Elevation Manager, and the script uses a key from Key Manager.
Improved version of the script is attached.
Now it does not matter where you specified the key, when you enabled the script, and fixed the problem with a large number of parallel requests.

Post's attachments

Attachment icon Horizon2_BingMaps.cs 13.97 kb, 5 downloads since 2019-06-04 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

11 (edited by danielesuppo 2019-06-04 16:35:24)

Re: Some problem extending the horizon

Yes, now it's working!
But... I still have a couple of issue... sorry...

1 - The horizon seem to me to use a different map zoom level, indeed as you can see in the 1st picture in attachment the texture is very different. If I zoom more, then the horizon seem to get the right texture, but it seem to be not "syncronized" with the regular map. I've tried to increase the resolution of the horizon (128) to see if it could help but it turn totally wrong.

2 - the elevation of the horizon seem to me a bit unstable. I had to offset on Y axis at -200 to not have it over the map, and still when I zoom the map it overlap is some areas the map, and zooming in or out it "jump" up and down, over and under the map, very quickly a few times

P.s. I'm using "Bottom mode --> Min Value" in Elevation Manager

Thanks a lot!

Post's attachments

Attachment icon 01.jpg 126.96 kb, 1 downloads since 2019-06-04 

Re: Some problem extending the horizon

1.1. Different zoom levels are a fundamental problem for such scripts.
It is impossible to solve or work around.
You need to find the right style and / or zoom where it is not visible.
1.2. Problem with resolution fixed.
2.1. The problem that the horizon is sometimes above the map fixed.
2.2. Problem with Bottom mode - Min Value fixed.
2.3. The problem with jumping elevations is not fixed.
This script is not designed for changing zoom.
Mapbox returns 256x256 elevations of values that are not counted in the quota. Bing Maps returns only 32x32 values.
If make requests for all the tiles, you will burn your quota very quickly.
So requests are made only for the required tiles.

I have an idea how to work around this (2.3).
But it takes some time to develop.
I think 1-2 days.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Some problem extending the horizon

It was difficult, but it seems like I made it work.

Post's attachments

Attachment icon Horizon2_BingMaps.cs 20.78 kb, 4 downloads since 2019-06-09 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Some problem extending the horizon

Hi, There is  a script using ArcGIS for horizon elevation ? Thank you

Re: Some problem extending the horizon

Hello.

Something like that.

Post's attachments

Attachment icon Horizon2_ArcGIS.cs 22.62 kb, 5 downloads since 2019-06-14 

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Some problem extending the horizon

nice
thank youuuuuuuu

Re: Some problem extending the horizon

Thanks a lot for your effort, it work!
I'd have just 2 more question:

1 - is there a way to tell the script at which distance from the camera the horizon should appear?
I try to explain better: in some situations the script create more horizon tiles on the back of the camera, and not in front.
As a result panning the Camera the orizon disappear, but as you move forward a little the new horizon tile appear (see pict in attachment).
I think that's some kind of optimization, so I'm wondering if it is possible to tell ("hey, I always want an horizon tile in front of the Camera... or something like that)

2 - Is it possible to get the elevation on the horizon tiles ? I have a very long path, and the piece of the path that is outside of the map does not get elevation

Many thanks!

Post's attachments

Attachment icon Untitled-1.jpg 11.64 kb, 1 downloads since 2019-06-17 

Re: Some problem extending the horizon

1 - I've partially solved this issue increasing count to 5x5

Re: Some problem extending the horizon

1. This is the specificity of the script.
This is not to optimize, but to simplify the script.
As it is, you cannot say - I want to have a front tile.

2. Something like this:

using UnityEngine;

public class GetElevationFromHorizon : MonoBehaviour
{
    public Horizon2_BingMaps horizon;
    private OnlineMaps map;
    private OnlineMapsTileSetControl control;

    private void Start()
    {
        map = OnlineMaps.instance;
        control = OnlineMapsTileSetControl.instance;
    }

    private void Update()
    {
        Vector2 size = control.sizeInScene;
        float el = GetElevation(new Vector3(size.x / -2, 0, size.y / 2));
        Debug.Log(el);
    }

    private float GetElevation(Vector3 pos)
    {
        double lng, lat;
        control.GetCoordsByWorldPosition(out lng, out lat, pos);

        float elevation = 0;
        if (GetElevationFromTile(lng, lat, ref elevation)) return elevation;

        if (Horizon2_BingMaps.overviewElevation == null) return 0;

        double mx = lng, my = lat;
        OnlineMapsUtils.LatLongToMercat(ref mx, ref my);
        elevation = Horizon2_BingMaps.overviewElevation.GetElevation(mx, my);
        return elevation;
    }

    private bool GetElevationFromTile(double lng, double lat, ref float elevation)
    {
        double tx, ty;
        int zoom = map.zoom - horizon.zoomOffset;
        map.projection.CoordinatesToTile(lng, lat, zoom, out tx, out ty);
        OnlineMapsTile tile = OnlineMapsTile.GetTile(zoom, (int) tx, (int) ty);
        if (tile == null) return false;
        Horizon2_BingMaps.CData data = tile["cdata"] as Horizon2_BingMaps.CData;
        if (data == null) return false;
        if (!data.hasData) return false;
        elevation = data.GetElevation(tx, ty);
        return true;
    }
}

P.S. Make Horizon2_BingMaps.overviewElevation as internal.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!

Re: Some problem extending the horizon

Thank-you!
So if I well understand I can use "GetElevation" from this class, in place of "GetWorldPositionWithElevation", for every object I want to get elevation, for both objects onto the Map and objects onto the Horizon, isn't it?

Re: Some problem extending the horizon

Yes, it is, because this script already controls elevations of the map.

Kind Regards,
Infinity Code Team.

Do not know the best way to thank the developer? Rate the asset in Asset Store!