5

I have been fighting with this for a week or so. I believe I have viewed the related questions on stack exchange, tried some of the suggested solutions that seemed appropriate and have found none that seem to address the same issue I seem to be having. So, I do not think this is truly a duplicate question.

Caveats: New to QGIS, Not a programmer, very much in the learning stages with all elements of QGIS. Using the program for fictional world creation. Have had considerable success but realize I am trying to use the program for a purpose that is not its main function.

Workflow to Date

  • I have downloaded a section of topographic data from Open Topography.
  • I converted the data to an excel format.
  • I have altered the x and y coordinates by a constant (basically taking a section of Peru and relocating it to 140 degrees East longitude and 40 degrees North latitude in a 5 degree section (i.e. 140-135E, 40-35N)
  • I saved the file as csv. I used the delimited text file layer function and successfully imported it into QGS 3.10 - both with and without GRASS 7.6. It appears (in the correct latitude and longitde I wanted, but with the original data for elevation) as a layer of very dense points (see photos.)
  • I have extracted vertices, extracted coordinates, made a successful contour map and seen the attribute table fully populated with almost 900,000 data points with x y and z coordinates where they should be.

The Problem

I cannot create a useful DEM raster from the data. In the past I have used drawn polygons and done the same extractions a above and then done TIN interpolations, with success, to create DEMs. TIN does not work in this case, and the row x column generated is 3 x 4, when it should be in the tens of thousands.

Attempted work arounds

  • I have saved the layer as a shapefile and as a geopackage.
  • I have tried extracting the vertices and then added the geometry attributes,
  • I have tried adding an elevation field and setting the z coordinate to that (this solved an earlier problem.)
  • I have converted the file to contours and extracted points from that again, in an effort to reduce the data.
  • I have attempted TIN and IDW interpolations - but with the density of the points, neither seems appropriate somehow? - too close together for TIN and too dense to need IDW?
  • I have tried various GRASS and other transitions (v.surf.idw, r.surf.idw, vector to raster in the rasterize menu) but none of these have worked in terms of changing that low numbers of rows and columns, which I (possibly erroneously) assume means that it is somehow not reading the data?

Screenshot

I have included a screen shot of the data points as they appear when I load the file. I have done them at a large (1:48,000 and small 1:1137) scale.One to 48,0001:1137

The Question(s):

  1. What data inputs would you need to see to help me solve this issue?
  2. Is there anything you might recommend I do differently here?
  3. While I have been looking for days at tutorials that don't seem to give me an answer, are there any tutorials you would recommend?

Additional Photos

I am adding several screenshots

The CSV load screen - you can see the organization of the table here

The attribute table for the layer once it is loaded

The settings as I save it as a new layer

The TIN interpolation settings

The raster disaster :)

A final shot showing the contour layer that can be generated from the CSV data.

Raster disaster number 2 after I tried setting everything to UTM and them the columns to 400 manually...

Reloaded the file, setting everything to UTM zone 7N - top bit looks good - will try it again

CSV Load Screen Attribute Table Saved to layer TIN load Raster Disaster Contours enter image description here enter image description here

  • 1
    Adding a screenshot of the csv and of the interpolated raster (including the bottom ribbon of QGIS, to show the CRS in use) would help. – RafDouglas Nov 28 '19 at 16:52
  • I am not finding a simple way to insert images... the guide says use control G but that doesn't work. Haven't coded HTML in a long time - suspect that there is something better required! I have lots of screenshots for you, but short of posting a new question, not sure how to share them. – Really New User Nov 28 '19 at 18:03
  • 1
    Click on edit under the Question, then control-v or right-click->paste ;) – RafDouglas Nov 28 '19 at 18:14
  • @RafDouglas - Just finished doing that :D – Really New User Nov 28 '19 at 18:33
  • 1
    you still need to reproject the data into UTM before interpolating ;). Also the 3x4 pixel you obtain is due to the settings in the TIN interpolation dialog: imgur.com/a/EeYONlb – RafDouglas Nov 28 '19 at 18:49
2

Using IDW or TIN is the correct approach.

Hints

Make sure:

  • the CRS of the Project is the same as the point file
  • the CRS is a projected one (like UTM, for example). If not, reproject the point layer into UTM.
  • select the (interpolated) layer extent to match that of the point file
  • set a meaningful Pixel Size (or, conversely, number of Rows and Columns)

Once you get the raster properly placed, you can tune parameters like Distance Coefficient P.

IDW interpolator example

enter image description here

Output example:

enter image description here

  • 1
    Thank you for the feedback. Unfortunately, I have tried those settings and it still gives me a 4x3 row and column with pixel at 0.10. – Really New User Nov 28 '19 at 16:45
  • 1
    This is already a good starting point, because the interpolator worked. Now you need to figure out the reference system and the resolution. – RafDouglas Nov 28 '19 at 16:50
  • 1
    I am using the same CRS (WGS 84) for both the project and the layer. The resolution sounds promising... how can I change that? I am going to post the two screenshots you suggested. Thanks again. – Really New User Nov 28 '19 at 17:50
  • 1
    I see the problem: you need a projected CRS, like an UTM for example! Otherwise the "pixels" you input are actually degrees :) – RafDouglas Nov 28 '19 at 17:57
  • 1
    That makes sense, and I have used Robinson World before. It doesn't put the information in the correct place, however. When the project is World Robinson, and the data is WGS 84, it seemed to display correctly, but you mentioned that the CRS for project and layer need to be the same. – Really New User Nov 28 '19 at 18:05
2

I must say this is an unusual question.

If I understand correctly, you want to take an SRTM elevation raster from one area of the world, and artificially move to somewhere else. If I'm mistaken in understanding your goal, then ignore the rest. If that is indeed what you want, then perhaps all you need is a "world file" (see Wikipedia). If you write a six line file with the same name as the original SRTM, and with the ".tfw" extension, then QGIS and other GIS software will move the file to the coordinates specified in the world file. See here for how to write an initial (correct) world file. Then change the last two lines to specify the shift.

If you nevertheless want to do the round trip: export to points, then move the points and reimport as raster, then here is a possible workflow in GRASS:

# Import original SRTM from Open Topology into GRASS 
# and set computational region to match the SRTM
r.in.gdal input=n31_e034_1arc_v3.tif output=srtm
g.region -ap rast=srtm
# Save raster pixels to a vector point layer. The -v option saves elevation values
r.to.vect -v srtm output=srtm_pts type=point
# Now do affine transform of points (here, 5 degrees in X direction and 10 deg in Y)
v.transform srtm_pts output=srtm_shift xshift=5 yshift=10
# Reset the computational region to the new, shifted vector
g.region -ap vect=srtm_shift
# Export x,y,z values and pipe directly into the r.in.xyz module to create new raster
v.out.ascii srtm_shift | r.in.xyz input=- output=srtm_shift

Here's an example where I shifted an SRTM tile from the East Mediterranean, north into the Black Sea :-)

shifted map

  • you did understand my question perfectly and this is genius! Now, I understood how to do about 5% of what you said but I will do some research. For clarification, I will follow the links about the ftw files you recommended. I have trouble getting GRASS to load alone as I can't get past the first issue of where the database is - don't even know how to set that up, so you get an idea of the level of beginner I am! I will try the world file idea first because the rest will require more questions! Thank you for this :) – Really New User Nov 29 '19 at 13:51
  • just for interest, did you produce the map you shared with the world file or the GRASS method? – Really New User Nov 29 '19 at 13:52
  • I think I have configured the world file correctly. Where do I save it so that it will be read with the SRTM when I load that file? And can I save the raster file with a new name and then call the world file the same thing? (if the original is srtm_13_05.tiff and I make it "Magic_pigs.tiff" and my world file "Magic_pigs.tfw" will that work? – Really New User Nov 29 '19 at 14:55
  • 1
    The map I showed was made with the GRASS approach. If you want to use the worldfile approach, then the file needs to be in the same directory as the tiff, with the exact same name, but extension ".tfw". That should be the easiest. – Micha Nov 29 '19 at 14:58
  • The tif file loaded - in the part of the map where it would correspond to it's real world location in Peru. I tried loading the tfw at the same time (obviously not a raster file and QGIS rejected it) but that didn't work. How do I get QGIS to read and act on the tfw file? – Really New User Nov 29 '19 at 15:05
0

I have found an unexpected work around. I can download a raster file from open topography and then georeference that file to the location I want. Worked nicely. Thank you @RafDouglas and @Micha for your excellent suggestions - both of which would work!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.