Hot answers tagged

3

There is a python module called rasterstats that does compute zonal statistics. For each Polygon, your fields, there will be the underlying rastercells accumulated by SUM, MEAN, MIN or MAX. You find more infos and examples here: https://github.com/perrygeo/python-rasterstats Otherwise you find an example without this module here: ...


2

My general opinion is that this is a lousy tool for creating a DSM however, @Andre Silva hit the nail on the head in using the maximum argument and you should mark his answer as correct because it directly addresses your question. Ideally, for a DSM you should use the first or last returns with an interpolation algorithm, and not merely a binning approach. ...


1

If you want GDAL you can use this (I found this code in another post and it works nice): rs = r'path\to\your\raster' def get_point_values(rs): src_shp = r'path\to\your\shape.shp' src_ds=gdal.Open(rs) gt=src_ds.GetGeoTransform() rb=src_ds.GetRasterBand(1) ds=ogr.Open(src_shp) lyr=ds.GetLayer() for feat in lyr: geom = ...


1

I can not help you within R, but using GDAL takes you further: gdalinfo acpcp.2000.nc tells you that the first two bands contain the lat and lon coordinates, and they are in WGS84 degrees: SUBDATASET_1_NAME=NETCDF:"acpcp.2000.nc":lat SUBDATASET_1_DESC=[277x349] latitude (32-bit floating-point) SUBDATASET_2_NAME=NETCDF:"acpcp.2000.nc":lon ...


1

One suggestion would be to ensure that the computational region is correctly set, i.e.: g.region rast=tile1,tile2,tile3,...,tilen -p Then you should run the r.patch command: r.patch input=tile1,tile2,tile3,...,tilen output=merged_raster You should be able to display the merged raster in your GRASS monitor. If it is still blank, try passing -z to ...


1

If the original data was rescaled to 8-bit it should be 0-255 and not 0-200. That aside you can take a normalization approach but shift the centrality over so the distribution will bound into the negative. Two normalization formulas that will do this are: Formula 1: [(x - "x min") / ("x max" - "x min") - 0.5) * 2] Formula 2: ["new min" + (x - "x min") * ...



Only top voted, non community-wiki answers of a minimum length are eligible