Animate Map with Blender: Difference between revisions
From wikiluntti
(Created page with "== Introduction == == Download Data == Download data from https://www.maanmittauslaitos.fi/ . The Licence is Maanmittauslaitoksen avoimien aineistojen CC 4.0 -lisenssi. There can be found * Map * Air photos * Height model == GIMP: Make a larger image == Change the Canvas size of each three downloaded image * Image → Canvas Size. Height to 2x. Superpose the images: make it larger. == Python: Adjust the scale of 3d map ==") |
|||
Line 14: | Line 14: | ||
Superpose the images: make it larger. | Superpose the images: make it larger. | ||
== Python: Adjust the scale of 3d map == | == Python: Adjust the scale of the 3d map == | ||
<syntaxhighlight lang="python3"> | |||
import rasterio | |||
import numpy as np | |||
from PIL import Image | |||
names = ['Q4121F.tif', 'Q4122E.tif'] | |||
imgs = [] | |||
for n in names: | |||
imgs.append(rasterio.open(n)) | |||
image = imgs[0].read(1) | |||
print( np.shape(image) ) | |||
for img in imgs[1:]: | |||
tmp = img.read(1) | |||
image = np.concatenate( (tmp, image ), 0) | |||
print( np.shape(image) ) | |||
print( image.max() ) | |||
print( image.min() ) | |||
image = 256*(image-image.min())/(image.max()-image.min()) | |||
im = Image.fromarray( image ) | |||
im = im.convert("L") | |||
im.save( "heightModel1.png" ) | |||
</syntaxhighlight> |
Revision as of 19:05, 3 June 2024
Introduction
Download Data
Download data from https://www.maanmittauslaitos.fi/ . The Licence is Maanmittauslaitoksen avoimien aineistojen CC 4.0 -lisenssi. There can be found
- Map
- Air photos
- Height model
GIMP: Make a larger image
Change the Canvas size of each three downloaded image
- Image → Canvas Size. Height to 2x.
Superpose the images: make it larger.
Python: Adjust the scale of the 3d map
import rasterio
import numpy as np
from PIL import Image
names = ['Q4121F.tif', 'Q4122E.tif']
imgs = []
for n in names:
imgs.append(rasterio.open(n))
image = imgs[0].read(1)
print( np.shape(image) )
for img in imgs[1:]:
tmp = img.read(1)
image = np.concatenate( (tmp, image ), 0)
print( np.shape(image) )
print( image.max() )
print( image.min() )
image = 256*(image-image.min())/(image.max()-image.min())
im = Image.fromarray( image )
im = im.convert("L")
im.save( "heightModel1.png" )