Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terrain under sea level is painted all blue #1142

Closed
lshachar opened this issue Oct 5, 2017 · 8 comments
Closed

Terrain under sea level is painted all blue #1142

lshachar opened this issue Oct 5, 2017 · 8 comments
Assignees
Labels

Comments

@lshachar
Copy link
Contributor

lshachar commented Oct 5, 2017

I live in Israel and we fly in many areas that are below sea level. unfortunately they are all painted blue, either by using lk8000's israel online maps , or by making a custom map with LKMaps_Desktop.(!)
This has been discussed by ryszard_lewandowski here (making his own maps, not for Israel - problem does not only relate to Israel maps) and by me here (either my maps or the online maps)

how it appears in lk8000:
screenshot_2017-10-05-13-32-15 custom

True water areas in Israel:
israel custom

The problem is already visible from the mapset area image :
isr_israel
(The entire area inland is blue)

I think that the problem is, the LKM file (for Israel) does not contain coast_area.* files! so, since it is unknown to lk8000 where the sea ends and land begins - everything below 0 altitude is painted in blue.
(Netherland's LKM map, for instance, contains three coast_area files: .dbf, .shp, .shx)

Unfortunately LK8000_Desktop Only creates .LKM file rarely for me, (It usually only creates .DEM files) So I can't find a way to create the coast_area files properly, and prove my assumption correct.


a bit more info:
Here is a screenshot from QGIS Browser of the water_area.shp inside the topological file LK ISR_ISRAEL.LKM :
israel_water_area shp

  • These are the correct water areas inside israel. no problem there.

I translated the terrain ISR_N_ISRAEL_250.DEM file to an .asc file using GIS2LKMAP which I found out about here, and it also looks fine:
qgis terrain file

  • Can't say much but it looks okay to me.
@brunotl
Copy link
Member

brunotl commented Oct 5, 2017

I think that the problem is, the LKM file (for Israel) does not contain coast_area.* files! so, since it is unknown to lk8000 where the sea ends and land begins - everything below 0 altitude is painted in blue.

you think right !

all LKM file without "cost_area.*" need to be rebuild ...

brunotl added a commit to brunotl/LK8000 that referenced this issue Oct 10, 2017
…er than 4095m

land surface elevation range of earth are [-428m , 8848m], range of color ramp are [0, 255]

currently we clip surface elevation to [0 - 4096], so all elevation bellow 0 are draw like sea (if topology doesn't include coast_area shape) and all elevation higher than 4096 are draw like invalid terrain (LCD Green).

for fix this problem :
 1 - calculate span of visible elevation
 2 - shift elevation by min of this range ( result range is [0 - 9276] )
 3 - scale result to range [0 - 255]
	for speed reason, scaling is made using bit shift, ( power of 2 scaling factor).

of course same algorithm are used for build color ramp.
brunotl added a commit to brunotl/LK8000 that referenced this issue Oct 10, 2017
…er than 4095m

land surface elevation range of earth are [-428m , 8848m], range of color ramp are [0, 255]

currently we clip surface elevation to [0 - 4096], so all elevation bellow 0 are draw like sea (if topology doesn't include coast_area shape) and all elevation higher than 4096 are draw like invalid terrain (LCD Green).

for fix this problem :
 1 - calculate span of visible elevation
 2 - shift elevation by min of this range ( result range is [0 - 9276] )
 3 - scale result to range [0 - 255]
	for speed reason, scaling is made using bit shift, ( power of 2 scaling factor).

of course same algorithm are used for build color ramp.
@brunotl brunotl self-assigned this Oct 10, 2017
brunotl added a commit to brunotl/LK8000 that referenced this issue Oct 19, 2017
…er than 4095m

land surface elevation range of earth are [-428m , 8848m], range of color ramp are [0, 255]

currently we clip surface elevation to [0 - 4096], so all elevation bellow 0 are draw like sea (if topology doesn't include coast_area shape) and all elevation higher than 4096 are draw like invalid terrain (LCD Green).

for fix this problem :
 1 - calculate span of visible elevation
 2 - shift elevation by min of this range ( result range is [0 - 9276] )
 3 - scale result to range [0 - 255]
	for speed reason, scaling is made using bit shift, ( power of 2 scaling factor).

of course same algorithm are used for build color ramp.
@lshachar
Copy link
Contributor Author

lshachar commented Nov 2, 2017

Beautiful work, Bruno!

screenshot_2017-11-02-02-03-16 - copy

@brunotl
Copy link
Member

brunotl commented Nov 2, 2017

thanks for feedback !

@brunotl brunotl added this to the FUTURE VERSION milestone Nov 3, 2017
@brunotl brunotl added the Bug label Nov 3, 2017
@pventafridda
Copy link
Member

pventafridda commented Nov 4, 2017

This is not a solution. See OpenCloseTopology lines 106 .. LKWaterThreshold is my solution.

Working perfectly since years, no need to change. Israel need fix on topology, nothing else.

@brunotl
Copy link
Member

brunotl commented Nov 4, 2017

if you have time for check all LKM files, it's your choice, i don't want to do that ( in fact i can't because i don't have tools for generate maps ).

in all case may fix work for general case and also fix few other bug ....

@pventafridda
Copy link
Member

Isachar says:
I think that the problem is, the LKM file (for Israel) does not contain coast_area.* files! so, since it is unknown to lk8000 where the sea ends and land begins - everything below 0 altitude is painted in blue.

Thats not how it works. because otherwise we would have netherlands in blue, for example. It is exactly the opposite: without coast lines you dont get the blue of the sea, because there is no "sea" in DEM. It is only terrain altitude, and we dont paint blue for terrain unless it is under a parameter called LKWaterThreshold, set by OpenCloseTopology when we load topology.
Now the problem is simply that without coast areas, we dont set the LKWaterThreshold to -1000.
I have to investigate why Israel has no coast lines, and that's all about this.

@pventafridda
Copy link
Member

pventafridda commented Nov 4, 2017 via email

@brunotl
Copy link
Member

brunotl commented Nov 4, 2017

he say right, that explain why your fix work for Netherland but not for Israel.

brunotl added a commit that referenced this issue Sep 3, 2018
…n 4095m

land surface elevation range of earth are [-428m , 8848m], range of color ramp are [0, 255]

currently we clip surface elevation to [0 - 4096], so all elevation bellow 0 are draw like sea (if topology doesn't include coast_area shape) and all elevation higher than 4096 are draw like invalid terrain (LCD Green).

for fix this problem :
 1 - calculate span of visible elevation
 2 - shift elevation by min of this range ( result range is [0 - 9276] )
 3 - scale result to range [0 - 255]
	for speed reason, scaling is made using bit shift, ( power of 2 scaling factor).

of course same algorithm are used for build color ramp.
@brunotl brunotl closed this as completed Sep 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants