Changes between Version 3 and Version 4 of PythonScripts
- Timestamp:
- Jul 26, 2018 9:20:11 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PythonScripts
v3 v4 40 40 The NASA SRTM dataset does not include areas of the earth containing no height data (ie: the ocean). However, Maperitive is dumb about what to do if it tries to get SRTM data for an ocean and none exists, and it will fail. This script fills in the SRTM data by generating blank files to fill in the gaps. SRTM files are named for their latitude and longitude (ex: 32N042W.hgt), so the file iterates through all possible images and when a file is missing, creates it. 41 41 42 This python script can be run on the command line and passed command line options. Run {{ python fill_terrain_tiles.py -h}} to see these options.42 This python script can be run on the command line and passed command line options. Run {{{python fill_terrain_tiles.py -h}}} to see these options. 43 43 44 44 This command has already been run on the USB drive, to create the SRTMGL1_full and SRTMGL3_full folders. These folders are linked in the Maperitive cache folder using directory softlinks. 45 45 46 46 = [[attachment:gen_terrain_image_script.py]] 47 One of the ideas for generating a terrain map of the entire world was to have Maperitive load in the SRTM height data, shade it, and create a set of geo-referenced images. Then another program (either Maperitive itself or GDAL) could be used to stitch these images together and create a set of web tiles from them. You can perform this step with gen_tiles_from_images_script.py. 48 49 This Python script outputs a Maperitive script based on the options passed into the Python. Run it with {{{-h}}} to see the available options. Run the script output with Maperitive.Console.exe. 50 51 This script divides the world into square "slices" based on a lat/long range, creates an image for this slice, and clears out the memory to create the next slice. Be cautious of the memory limitation here! A 15 degree slice contains 255 SRTM images. At sample rate 1, using SRTM3 (lower-resolution) data, this still requires 650MB of RAM per slice. 52 53 The script has an "index" parameter. If Maperitive crashes or runs out of RAM after slice 103, for example, you can run this script again and tell it to start at slice 103, so the work doesn't need to be repeated. 54 55 This script was run to create the Images folder on the USB drive, but those images are so large as to be impossible to load into Maperitive at the same time. It was also used, with SRTMGL3 at sample rate 6, to create the full world map up to zoom level 6. This worked well because each slice of the world was a very small image at this resolution, but still looked good on the map. The output of this process is incorporated into the Tiles folder on the USB drive, up to zoom 6. 47 56 48 57 = [[attachment:gen_tiles_from_images_script.py]] 58 If you used gen_terrain_image_script.py to create a folder of georeferenced images, this script can be used to create a Maperitive script which loads all the images back into Maperitive and generates a web tileset from them all. Be sure you have enough RAM to do this! It is recommended to have image data created at a high sample rate and/or with SRTMGL3 data. 59 60 This Python script outputs a Maperitive script based on the options passed into the Python. Run it with {{{-h}}} to see the available options. 61 62 Note that each zoom level takes four times more hard drive space than the one before it. Zoom 7 takes 100 MB. Zoom 8 takes 400 MB. Be sure you have enough for the zoom level requested. Also, very high zoom levels will look ugly if the input image data is too low-resolution. 49 63 50 64 = [[attachment:gen_terrain_tiles_script.py]] 65 This script fixes some of the problems of generating the world map from images. It is capable of producing a higher resolution map from zoom levels 7 up. To go any lower will require [[wiki:ZoomLevels some tweaking]] for the map not to have white stripes of missing data.