# Generating landscapes. How to set real values?

**URL:** <https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018>\
**Category:** Coding Questions\
**Created:** [October 29, 2019, 3:00pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018 "2019-10-29T15:00:05Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tanya](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@Tanya](https://discourse.processing.org/u/Tanya)\
**Post date:** [October 29, 2019, 3:00pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/1 "2019-10-29T15:00:05Z")

</div>

Hello! I’m creating a program in JavaScript which will generate a landscape. It would be great to use real z-coordinate values. The idea is to use some function and it’ll return me the altitude of a certain point. Well, I got a question. Where can I find this function? How can I find the altitude of certain coordinates?

---

<div class="post-metadata">

**Author:** ![PhoenixStormJr](https://avatars.discourse-cdn.com/v4/letter/p/43a26b/32.png) [@PhoenixStormJr](https://discourse.processing.org/u/PhoenixStormJr)\
**Post date:** [October 29, 2019, 7:01pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/2 "2019-10-29T19:01:47Z")

</div>

I’m afraid the Z axis is either very hard to use or does not exist. However you could zoom in and out of images to make a Z axis. Besides this i dont really know much about 3d graphics. Sorry if i couldnt help

---

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [October 30, 2019, 1:33pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/3 "2019-10-30T13:33:43Z")

</div>

Hi @Tanya,

Would you mind to elaborate on your description ?

These points in particular:

- Are you generating a 2D landscape (like a painting) or a 3D terrain ?
- What is the structure of this landscape/terrain (mesh, nurbs, pixels, …) ?
- What do you mean by “real” coordinates ? (altitude of a _real life_ mountain or Z-coordinates of your generated terrain/landscape)

---

<div class="post-metadata">

**Author:** ![Tanya](https://avatars.discourse-cdn.com/v4/letter/t/35a633/32.png) [@Tanya](https://discourse.processing.org/u/Tanya)\
**Post date:** [October 30, 2019, 4:23pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/4 "2019-10-30T16:23:50Z")

</div>

1. 3D terrain
2. It looks like a grid
3. Real altitude above sea level  
Now I have a program which can generate some random landscape. But I want to create real landscape that already exsits on the planet.  
 ![%D0%91%D0%B5%D0%B7%D1%8B%D0%BC%D1%8F%D0%BD%D0%BD%D1%8B%D0%B9](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/b/b3d7e2cb6f92eb664e2074d019324998b80922a2.png)

---

<div class="post-metadata">

**Author:** ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)\
**Post date:** [October 30, 2019, 7:10pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/5 "2019-10-30T19:10:11Z")

</div>

you are looking for a data base that contains the height information for any given point on the earth.

- First we have to look at the resolution. Do you think of your continent or your home town?

- Second the amount of data is just huge.

- Third: You cannot download this. You better access data like this online. Which is always a hassle since it’s complicate language.

Read this:

[https://wiki.openstreetmap.org/wiki/Relief\_maps](https://wiki.openstreetmap.org/wiki/Relief_maps)

---

<div class="post-metadata">

**Author:** ![solub](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/solub/32/333_2.png) [@solub](https://discourse.processing.org/u/solub)\
**Post date:** [October 30, 2019, 7:18pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/6 "2019-10-30T19:18:07Z")

</div>

I think what you are trying to achieve is similar to a [DEM](https://en.wikipedia.org/wiki/Digital_elevation_model) (Digital Elevation Model).

DEM are often made from 2 types of data:

- satellite data (imagery or/and height)
- [LiDAR](https://en.wikipedia.org/wiki/Lidar) data (point clouds)

The latter is usually more dense and detailed (3D representation of trees, cars, houses, …) than the former that just gives the elevation.

[![](https://www.atlasofplaces.com/atlas-of-places-images/_scaled/ATLAS-OF-PLACES-LIDAR-I-IMG-4.jpg) ](https://www.atlasofplaces.com/atlas-of-places-images/_scaled/ATLAS-OF-PLACES-LIDAR-I-IMG-4.jpg)  
_(example of a LiDAR point cloud, [source](https://atlasofplaces.com/research/lidar-i/))_

In your case you would need to feed your grid with either one of these two (the former preferably) but you should note that:

- elevation data is rather difficult to get a hold of
- if often comes at a price (you have to buy it)
- the variety of formats can sometimes be baffling

That being said you can find free alternatives [here](https://gisgeography.com/free-satellite-imagery-data-list/) (satellite data) or [here](https://gisgeography.com/top-6-free-lidar-data-sources/) (LiDAR data).

Another approach would consist in approximating the height of a terrain by mapping the brightness of the pixels of a black and white satellite photograph against a range of arbitrary values.

 ![heightmap](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/802b0be7140f3db33b7b20ee75a72258f0cbd986.jpeg)  
_(satellite image example)_

Unfortunately this is very likely to lead to uneven and erratic outputs.

---

<div class="post-metadata">

**Author:** ![uheinema](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uheinema](https://discourse.processing.org/u/uheinema)\
**Post date:** [June 11, 2020, 12:56pm UTC](https://discourse.processing.org/t/generating-landscapes-how-to-set-real-values/15018/7 "2020-06-11T12:56:19Z")

</div>

Good source to generate grayscalr maps is

[https://tangrams.github.io/heightmapper/](https://tangrams.github.io/heightmapper/)
