[GRASS-user] [Qgis-user] extracting elevations from DEM at certain points

(cc-ing to the GRASS user’s list for future archiving and additional help)

Always when importing data into GRASS you must have the LOCATION coordinate system the same as the input data. If your DEM is Long/Lat, then The problem is your are trying to import coordinates from some projected CRS to a Long/Lat locations. The import expects coordinate values between -180 and +180. See the error message in your screen shot. For a complete report, please post:

···

On 12/18/2015 03:08 AM, Szilard Albert wrote:

Hello,

I decided to go down the GRASS path, I got some problems though right at the beginning when trying to import my points, after

loading my DEM.

Initially I thought the issue might be something to do with the fact that I have my DEM coordinates as Lat/Lon degrees, and point coordinates as East/North in meters. I probably need to work on the projection setup.

  • create a LOCATION with Long/lat CRS, and import that raster.

  • Next create a new LOCATION with the same CRS as your points and import the points into that LOCATION.

  • Now switch back to the Long/Lat LOCATION (with the module g.mapset...)

  • and reproject the points to this Long/Lat CRS with v.proj...

``

However, also tried loading the points in a brand new project with no DEM, similar errors.

My X and Y values are in column 4 and 5, with the column separators being spaces (and double/triple spaces). I would like to

keep my input files as they are. I have tried a few things, like editing my input to keep only columns 1, 4 and 5, removing

decimals, keeping one space only, removing the space from before column 1 etc…still parsing errors.

Tried exact command syntax you suggested (adjusting for columns 4 and 5), similar errors…
Tried both command line and gui, same errors.

It is something with my input text file I think, but cant find the issue.

  • the first few lines of your points text file
  • the outputs of g.region -p and g.proj -p for both of the above locations
  • the output of r.info for the DEM layer

Would you have any suggestions?

thanks

Szilard

Inline images 1

On 16 December 2015 at 17:37, Micha Silver <micha@arava.co.il> wrote:

On 16/12/2015 07:57, Szilard Albert wrote:

Hello,

I need to extract elevation values from a DEM at certain points for which I have X and Y values.

My points are contained in several profiles, each profile with hundreds of points.

My input is a text file, one file per profile, with the following format:

PointA X Y

PointB X Y

PointZ X Y.

I would like a solution where I can feed the above text input, and get my output as another text file

with similar format, Point X Y Z (or Point Z X Y). Alternatively just a text file with one column containing Z,

but exactly same number of rows, so I can copy and paste to the input.

One single command that solves one point only would do as well, I would just create a script file from my every

text file for every line…

Any suggestions would be greatly appreciated.

I am using QGIS 2.8 Wien in Ubuntu.

If you want to work with GRASS, there’s an easy workflow for this:

First, as always, create a GRASS location with CRS matching your DEM and points, then

Import your text file into GRASS as a points layer:

v.in.ascii input= output=points columns=“label text, x double, y double” x=2 y=3 sep=space

Add a column to hold elevation

v.db.addcolumn map=points column=“elev double”

Import DEM raster

r.in.gdal input= output=dem

As always,set the region

g.region -p rast=dem

Now get elevations for all points

v.what.rast map=points column=elev raster=dem

And create the output results file

v.out.ascii input=points output=points.csv column=“elev” sep=space

Thank you.

Szilard

This mail was received via Mail-SeCure System.

_______________________________________________
Qgis-user mailing list
[Qgis-user@lists.osgeo.org](mailto:Qgis-user@lists.osgeo.org)
List info: [http://lists.osgeo.org/mailman/listinfo/qgis-user](http://lists.osgeo.org/mailman/listinfo/qgis-user)
Unsubscribe: [http://lists.osgeo.org/mailman/listinfo/qgis-user](http://lists.osgeo.org/mailman/listinfo/qgis-user)
This mail was received via Mail-SeCure System.

Micha Silver
Arava Drainage Authority
cell: +972-523-665918

This mail was received via Mail-SeCure System.

Micha Silver
Arava Drainage Authority
+972-523-665918