Topic: Intercepting elevation data only tiles one corner.

I'm using geoserver to get my elevation data, limit it using a bounding box and 32 by 32. It returns a greyscale image, which I pass in the pixel values normalised (I guessed between 0 and 600, since that's around the values I get from Bing API).

I've added my function to the OnGetElevation event handler, but it only seems to do one corner of the map. Any ideas?

Re: Intercepting elevation data only tiles one corner.

Hello.

Unfortunately, I did not understand your question.
Please rephrase it in detail.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

I intercept the elevation data as per your example.

Then, I download a greyscale png depicting the heights using the front left and bottom right coordinates as my bounding box.
I set the height and width of this to be 32x32, and then call GetPixel on the image for each value and set the short[,] values in elevation to it.

I normalise the GetPixel values between 0 and 600 instead of floating point.

When I do this, only the top right corner of the map has elevation. I'm not sure if it's correct for that bit, or if it is meant to be for all the tiles currently on the map. It also does not -seem- uniform to just one tile, but it is hard to tell.

Is there any more info needed?

Re: Intercepting elevation data only tiles one corner.

Online Maps uses elevation data 32x32 (by default, can be increased) for the entire map.
So you need to look for a bug in the generation of elevation data.
Just show your texture on UI to see what happens.

P.S. Additionally, and is not related to your question. By default, most editors use PNG - 8 bits per channel, so perhaps you have lost the accuracy of your elevation data.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

When I show the texture as a normal Texture2D on an image, it seems to be fine, and is 32x32. Is that what you meant? I'll compare the exact values with Bing for the exact same coordinates, and see if they match.

Do the values of the elevation matter that much, by the way, since I imagine you normalise them on your side? As in, is it just the correct ratios you care about, or do they actually match against something? Would a greyscale height map be sufficient enough?

Re: Intercepting elevation data only tiles one corner.

Values are important, but not very much.
You just get an incorrect scale of elevations.
But not the problem that you described in your previous post.

Yes, the grayscale height map can be used.
To avoid a problem with an incorrect scale, you need to know the elevation range of the image (for example, black is 100 meters, white is 2500 meters) or elevation scale (for example, elevation = (grayscale - 0.5) * scale).
In this case, you can easily calculate the correct elevation values.

If the problem is not in the texture, then this is need to tested.
If you send me your script and sample of elevation data, I can test it.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

I managed to solve it smile. The coordinates I was passing in were incorrect (D'oh!). They looked right when passed directly in the link, but not in unity!

Is there a quicker way of setting the elevation without looping through the image pixels? Thanks!

Re: Intercepting elevation data only tiles one corner.

Here it is more important what your server can return?!
Your server can return byte array (32x32 short array)?
If so then I think this will be the fastest way. You just download and use it.
If your server can only return an image, you forced to work with pixels.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

I don't think it can hmm.  That's fine, then.

I'm having another issue, though. When I play, it doesn't use the elevation data immediately. I have to pan/zoom or disable and re-enable elevation for it to pull the data.

Also, when I pan/zoom large amounts (In terms of tiles, not coordinates), it stops retrieving the elevation also. I tried disabling and enabling elevation at runtime where it seems to have stopped, and it gets elevation fine again after I re-enable it. It seems that the OnGetElevation event isn't called.

Re: Intercepting elevation data only tiles one corner.

Online Maps makes a download elevation request when the map is first updated.
Perhaps you subscribe to OnGetElevation later.

After the request, Online Maps is waiting for a response from Bing Maps Elevation API or invoking SetElevationData.
Even if the position or zoom has changed Online Maps does not make a new request until the previous one ends.
In your case, perhaps some error occurred, and you did not invoke SetElevationData.
Online Maps waits for this, and does not make a new request.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

I think I do it in my Start() function, so I'll try move to Awake().

Do you think that because the previous isn't done by the time a new request is done, that it hangs? This seems like a plausible explanation, since geoserver seems quite slow. Do you have any experience with it?

Is there any benefit to using your WWW class opposed to normal one for texture downloads? Wonder if I could just cancel the previous elevation by using SetElevationData with no data, and then polling the request again?

Re: Intercepting elevation data only tiles one corner.

Moving this to Awake does not make sense, because:
- If your script starts with the map, you will get a NullReferenceException.
- If the script does not starts with the map, this will not change anything.

I have experience in what?
If you mean - did I see such behavior. Of course, yes, many times. The server may hang or return an error. You need to handle this behavior correctly.
If you mean - do I have experience in setting up a geoserver, then no, I do not have such experience.

You can use the WWW class.
OnlineMapsWWW is of great importance for the core, but has almost no advantages for you.

Unfortunately, in the current version you do not have a good way to cancel the request (except Reflection).
We will add this feature to the new version.
The new version will be available at the beginning of the week.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

I just force elevation off/on after I subscribe to the event, and make it wait .1 seconds. This seems to have fixed it.

In geoserver. Thought I'd ask, just in case!

Yes, I tried making a Timeout function which waits a specific amount of time, and if the elevation hasn't been set by then, then to set them to 0. This doesn't seem to work particularly well.

Even when I scroll through smoothly, there seems to be an issue. The elevation doesn't match the tiles when I pan. If I disable/enable elevation after I pan, it works again, until I start to pan again. I'm not particularly sure what to do!

Re: Intercepting elevation data only tiles one corner.

The new version is already available through the built-in update system.

Use OnlineMapsTileSetControl.GetElevation to force Online Maps to request new elevation data.
Use OnlineMapsTileSetControl.CancelCurrentElevationRequest to cancel the current request for downloading elevation data.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

Ah, ok!

This doesn't solve the panning issue, though. It seems to flip the values for the map when I pan. So blacks are peaks and whites and whites are troughs.

16 (edited by nbhandari 2017-11-27 12:51:19)

Re: Intercepting elevation data only tiles one corner.

Since I manually panned, I forced a call to update the elevations, so it was calling it twice, which somehow flips them. I've stopped calling them twice, which has solved the flipping issue.

I've put debug statements to check whether the elevation request has timed out, or if it sets it, and it doesn't seem to time out. But if I pan a lot, it still stops updating, and no more calls are made.

EDIT:  I got the latest version from the asset store, not in the in-built one, like you said! I used the in-built updater, and now everything seems to work great! I don't need to disbale/enable elevation on the start, and even if it doesn't update immediately, it does after a second or two! Seems to work perfectly now. Thank you so much smile

Re: Intercepting elevation data only tiles one corner.

It is for these purposes that we have added the ability to cancel the request and force to make the request again.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Intercepting elevation data only tiles one corner.

Yes, sorry. I changed my post above to say it's all sorted! Thank you!