[Tutorial] Downloading USGS Heightmap Data

Discussion in 'Content Creation' started by Iceman00789, Sep 5, 2013.

  1. Iceman00789

    Iceman00789
    Expand Collapse

    Joined:
    Feb 4, 2013
    Messages:
    72
    Downloading and Converting USGS Heightmap Data

    The following is a tutorial on how to download USGS heightmap data. It may contain some vague references as to how to implement it in-game, but for a full tutorial using L3DT generated heightmaps you should refer to Fundador's thread.

    Websites & Tools Needed:
    USGS The National Map Viewer
    MTL Calculate Distance... Between Lat/Long Points
    USNA MICRODEM Download (DL ~20 MB)
    Image Editing Program (Photoshop, Gimp, Etc.)

    Downloading The Required Programs and Files:
    First thing, download the United States Naval Academy MICRODEM program to get that out of the way. Secondly, open up the United States Geological Survey's "The National Map Viewer" (TNM). After it loads you should see a window similar to this in your browser.
    USGS_TNM-blank.jpg
    USGS TNM v2.0
    Some areas of interest that will be used later are as follows.

    1. Tools Menu
    2. Cursor Position
    3. Order Menu
    First you should navigate to your area of interest by using your choice of tools. You can use the "Map Navigation" tool to drag the map and the scroll wheel to zoom in, or you can use the "Zoom in Box" tool. I prefer the latter as I can drag a box around my area of interest.
    USGS_TNM-zoomed.jpg
    (Imagery Topo)

    You'll notice that I enabled the Imagery Topo mode in the top right-hand corner to help me recognize my area better. Now that you've found your area of interest you will need to draw a square. The way the selection process works is you enter the coordinates for the 4 corners of the box NW first, then NE, SE, and finally SW. Imagine where the NW corner of your selection is going to be.[SUP]1 See Tip[/SUP] Once you have pictured it, select the "Find Coordinates" tool from the Tools Menu and click where the NW corner of your map is going to be. Give it a second to load and a light blue thought bubble should pop-up with some values in it.

    Copy the first "DD" value. Open up the MTL Calculate Distance... Between Lat/Long Points webpage and paste that value (latitude) into the first column on both point 1 and point 2 rows. Then go back to the TNM and copy the second DD value (longitude) then paste it into the second column of both the point 1 and 2 rows. After you have pasted those you will need to play around the second value (longitude) in the Point 2 row until you get the desired distance. SAVE THIS DISTANCE.
    Int_distance.jpg
    P1 to P2 Distance (NW - NE)

    For example I wanted to make a 2 km x 2km map so I fiddled with the value until I got a 2 km distance. Write down those values somewhere for reference.

    Now we need to find the SE corner. Copy the values from the Point 2 row to the Point 1 row, so now point 1 should be what point 2 is and the distance should be zero. Now do the same thing as previous except we will be changing the latitude value of the SE corner (column 1, row 2). You should now have a value for the SE corner that is the same distance from the NE corner, as the NE is from the NW.

    Finding the SW corner is the easiest. Just copy the southernmost latitude you found, in my case: "42.40101" and then copy the westernmost longitude you found, in my case: "-114.3680" and you have it. For example my final values are now this:

    table_1.jpg

    It can also be expressed this way, especially since that is how this program does it.

    table_2.jpg
    Finally we can get our data downloaded. After you have all those values recorded switch back to the USGS TNM tab. Select the "Bounding Box from Coordinates" tool from the Standard Tools Menu and enter the data in the format show above. After you enter the data and click "Draw Area" you should get a window similar to this.
    data_for_dl.jpg

    Mark the checkbox labeled "Elevation" and click next. You should now have a list of download options. Select the smallest value GridFloat. In my case this is 1/3 arc second. Some of you may have 1/9 arc second. That is a higher resolution.
    checkbox.jpg

    Click "Next" then in the left panel your cart will show up with the item in it. You can then click "Checkout." On the next screen you can enter your email address and place your order. When you open your email there will be a link to download your order.
    checkout.jpg

    While you are waiting for the download to finish open up the install file for MICRODEM that you downloaded earlier and install it. After you get it installed open the program up and it should ask to download and install a few other required files. Go ahead and say yes to all of them. After this is finished and your data is downloaded go to the .zip file you just downloaded and unzip it. Then open MICRODEM back up and select, "File>Open>Open DEM" or press the icon pictured below.
    Open_DEM.jpg

    Navigate to your newly unzipped folder and select the only file in there that end in a ".flt" Open that up and click "Yes" on the next dialog box. You'll then have to wait for it to load in. A progress bar will be displayed. When it loads you should see something like this.
    elevation_map_orig.jpg

    Don't worry. We'll fix it to the correct height map eventually. First thing we need to do is select the area we need to use. Remember those coordinates from earlier? There's a reason we saved them. Right click anywhere on the map and select "Modify map area" and then another menu will pop up. Select "Keyboard corners" in this one. A dialog box will pop up again. Click on the button in the Northwest corner that says "NW" and another box will open up. Enter in your latitude and longitude for the NW corner from the earlier calculations. Make sure you enter both values positive and use the bubbles to select the correct hemisphere.
    map_corners.jpg

    Click "OK" and then do the same for the SE corner, but obviously using the SE corner values. Then click "OK" in both dialog boxes and a loading bar for drawing the map should come up again. Once it completes drawing we only have a few steps left until we are ready to use our data in BeamNG.Drive. First thing first, if you have any grids or legends showing up we will need to get rid of that. Right click the map again and select "Legends/marginalia" and another dialog box will pop up. Uncheck all four boxes then click the "# Grid" button and change the grid option to neither. After you have done this click "OK" and then click "Redraw Map." After it is done drawing the map all the grids and legends should be gone. Then you can click "OK (Close)."
    legends.jpg

    Our next thing to do is to right click on the map and select "Display parameter>Elevation." Another dialog box should pop up. Inside this one we will change the Display Colors from "Chroma depth colors" to "gray scale (monochrome)" and then we will click on the "z Range" button to the right. Inside that box we will do two things. First, change it from "percentiles" to "specified" and second we will write down the Max and Min values that are there for later.
    grayscale.jpg

    Click "OK" in both dialog boxes and wait for it to draw the map again. The next process we need to do is to save our map. First thing first, go to "File>Save map as image>As GEOTIFF, screen scale (grayscale)." Save it wherever you like, named whatever you like. DON'T EXIT THE PROGRAM YET. Then open it up in photoshop or whatever and find the dimensions. Chances are it is a pretty small picture. Don't go blowing it up, because we can fix it. Possibly... Go back into MICRODEM and right click on the map once more and select "Modify map area" again except this time the next thing we will be selecting is "Set map pixel size." Chances are it is probably 7 or something like that. Bump it down to 1 and click okay. It'll redraw the map again and then you can save the image as a GEOTIFF again. Keep playing with the "Set map pixel size" until you get close to a desired dimension in your photo-editing program. Chances are you'll have to re-size it down a bit so the smaller side is a power of 2 and then you'll have to crop the longer side to make it perfectly square as I've never had a map come out perfectly square from this program.

    There's two last things though. Remember way back when we were calculating distance between two coordinates and you wrote that distance down? You'll use that for the "Meters Per Pixel" setting when you import a height map to BeamNG. To get the proper-ish value you'll divide the real side distance by the pixel distance. For example I got ambitious and re-sized my map to 4096 pixels and my original distance was 2 km, so that would be 2000/4096=0.48828125

    The other thing is the height scale. If I understand it correctly that is the distance from full black to full white and if we exported our map correctly, which I am fairly confident we did then we should have a map with a full range of black to white. The two values we wrote down for this were the Max and Min on the z Range. Mine were 2232 to 914 so that would be 2232-914=1318 and if I understand correctly that would be the right value to enter in the height scale box in BeamNG.

    Thanks for reading my tutorial. If you have any tips on the process and would like to share please feel free to. If you see any typos feel free to PM what they are. And just remember that this tutorial has nothing to do with using BeamNG, but only getting real height map data for it. If you don't know how to build a map and would like to, please refer to Fundador's thread: Tutorial-Making-a-terrain-for-Beam-NG-(in-depth-guide-with-pictures)

    Tips:
    1. Use the "Measure Distance" tool in the "Advanced" tab of the tools menu to get a general idea of the size of the map you are going to be making.
     
    #1 Iceman00789, Sep 5, 2013
    Last edited: Oct 8, 2016
    • Like Like x 2
  2. Iceman00789

    Iceman00789
    Expand Collapse

    Joined:
    Feb 4, 2013
    Messages:
    72
    I finished the tutorial finally. Someone else will have to try it to see if it works for them.
     
    • Like Like x 1
  3. Stew2000

    Stew2000
    Expand Collapse

    Joined:
    Aug 23, 2013
    Messages:
    33
    Thank you for this. It does work.
    My first thought was to do Bonneville Salt Flats.. but that turned out to be a bit too ambitious. I need to rethink up a smaller area :p
     
  4. Yotaak

    Yotaak
    Expand Collapse

    Joined:
    Aug 11, 2012
    Messages:
    255
    Holy crap, thanks Iceman. This must of taken you days to complete.
     
  5. Pinecones

    Pinecones
    Expand Collapse

    Joined:
    Aug 20, 2013
    Messages:
    67
    Very cool tutorial! Thanks
     
  6. Iceman00789

    Iceman00789
    Expand Collapse

    Joined:
    Feb 4, 2013
    Messages:
    72
    It probably took around 6-8 hours of my time to write this Friday night. With everything already downloaded. Unfortunately my result didn't turn out so well. That's why I didn't show it. Mine would take a lot of work in photoshop to get smooth.
     
  7. JDMClark

    JDMClark
    Expand Collapse

    Joined:
    Aug 10, 2013
    Messages:
    1,347
    Gah man I feel like im a smart person but when i take on tasks like this i realize how unintelligent I am. There is a place I'd love to import into beamng and make a road on. 2 of my friends have wrecked on this road racing me so i figured it would be interesting to have on beamng. Sad thing is, im no where near sure how to get the latitude and longitudes for everything.

    And i dont have any photo editing software. What is the primary reason for using photoshop ect. I didnt clearly understand it.

    basically im an idiot.


    Alright NVM the post above, I did a cheap trick and got the file of the location I want. Going to try and do the rest of the steps.
     
    #7 JDMClark, Sep 10, 2013
    Last edited: Sep 10, 2013
  8. Doyle524

    Doyle524
    Expand Collapse

    Joined:
    Dec 4, 2013
    Messages:
    52
    Humongous bump here, I know, but could somebody tell me if it's possible to use the IMG format instead of GridFloat, and if so, how? I have 1/9 resolution in IMG for the area I'm trying to use, but the highest GridFloat is 1/3 resolution. When imported, even at 4096x4096, it is WAY too blocky to even be a good starting point. Thanks
     
  9. Leet34

    Leet34
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    225
    USGS web page doesnt work for me, its completly frozen !
     
  10. DJayFresh

    DJayFresh
    Expand Collapse

    Joined:
    Apr 20, 2014
    Messages:
    1
    Thanks for the awesome tutorial, I found some additional help on getting them loaded in game from http://www.beamng.com/threads/2764-...in-for-Beam-NG-(in-depth-guide-with-pictures). But I couldn't have loaded any cool real world terrains without you!

    DJayFresh & ThisIsDef

    - - - Updated - - -


    USGS's been under construction. Which ended today, I'd give it a try again.
     
  11. Leet34

    Leet34
    Expand Collapse

    Joined:
    Aug 8, 2013
    Messages:
    225
    Thanks for telling me.

    EDIT: Still doesnt work ... ;(
     
    #11 Leet34, Apr 20, 2014
    Last edited: Apr 20, 2014
  12. Autofan

    Autofan
    Expand Collapse

    Joined:
    Jun 26, 2013
    Messages:
    470
    Thanks for the tutorial, I will have to try this sometime. :)
     
  13. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,421
    Finally, something that I can use that won't cost tons of bucks to make free mods. Thanks a million.
     
    • Like Like x 2
  14. gigawert

    gigawert
    Expand Collapse

    Joined:
    Sep 6, 2015
    Messages:
    2,029
    Why would it cost tons of bucks?
     
  15. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    But, but...

    You liked this like 3 years ago. Plus you've done real land data before.
     
  16. bob.blunderton

    bob.blunderton
    Expand Collapse

    Joined:
    Apr 3, 2015
    Messages:
    3,421
    L3DT costs money + I don't 'steal' software + I'm retired/disabled and on a fixed income and L3DT free only does up to 2k resolution.
    I've done real land data using L3DT trial. Now, I've just pushed the like button yesterday, wasn't on Beam forums 3 years ago. It was posted 3 years ago, I've just found it.


    I've been talking with the devs on trying to get an more relaxed file-format restriction for height maps. Seeing as no windows software natively works with the 16bit format except commercial software (and Microdem).
     
    • Like Like x 1
  17. iheartmods

    iheartmods
    Expand Collapse

    Joined:
    Aug 8, 2012
    Messages:
    1,482
    My tired mistake.

    Apologies.
     
  18. gigawert

    gigawert
    Expand Collapse

    Joined:
    Sep 6, 2015
    Messages:
    2,029
    2k resolution is just fine for many maps.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice