Tag Info

New answers tagged

0

1) resample results in 50% improvement I was able to get about 50% improvement by resampling directly from the cld raster to a new raster with the same extent/resolution as r and a nearest neighbor sampling method: system.time({ mat<-as.data.frame(getValues(r)) mat$landuse<- NA mat$landuse<-getValues(resample(cld,r,method='ngb')) }) user ...


0

Use nan_to_num to replace nans with zeroes. In the calculator, it will look like this: nan_to_num(A@1) + nan_to_num(B@1)


0

One way is to convert the creek distances to integer format if they are not already integers. For more precision you can multiply them by some larger value (a "scale factor") and round; later you can divide by that same value. Because the creek distances are integers, you can perform a Euclidean allocation (usually at the same time you compute the ...


0

This effect could be a consequence of having different point densities within the flight line overlap regions. A possible solution would be to homogenize the LiDAR cloud. With Fusion the command line to accomplish such task is ThinData: ThinData allows you to thin LIDAR data to specific pulse densities. This capability is useful when comparing analysis ...


0

yet another option, but limited to the cpt-city ramps. This works if you have the Color Manager plugin installed and you've elected to install the cpt-city ramps You can drop the svg ramp file onto the canvas as an image. On my ubuntu setup they appear under ~/.qgis2/cpt-city/


3

Another option is to add a rectangle shape to the composition, then style the rectangle using a gradient fill with the same color ramp as your raster. This can be done directly in QGIS, no image editing or html required.


2

A workaround without pictures is to add the gradient using a HTML frame and some CSS magic: <html> <head> <style type="text/css"> body { background: -webkit-linear-gradient(left,red,orange,yellow,green); } * { color: white; font-family: "Source Sans Pro", Arial, sans; font-size: 24px; } </style></head> <body> <div ...


2

I think using ST_SetValues is better. The reason is the wkb structure of raster may change in future version so your code may break at that point. ST_SetValues since its a user facing function will always be updated to be inline with internal structure. Also forgot to add -- that's an old ancient doxygen link when raster was separated (and www.postgis.org ...


0

At the end I have used Raster, that is supported by PostGIS directly (but with GDAL extension installed). It has functions, that suits my needs - see http://postgis.net/docs/manual-2.1/RT_reference.html I can select value at a certain position directly, also update this value very easy. All operations seems fast enough in read mode (in times of ms).


0

It looks like the ability to create rasters is not yet available in the driver. However, you can create a layer using your standard PostgreSQL Python driver (i.e. psycopg2) and then open it from GDAL. So you'd create a layer using ST_MakeEmptyRaster and ST_AddBand: CREATE TABLE rtest (gid serial primary key, rast raster); INSERT INTO rtest (rast) VALUES ...


1

This can be easily done with the RasterExpressionEvaluator followed by RasterBandNoDataSetter. First use a RasterExpressionEvaluator. Set its interpretation to what you want (Int8 or UInt8) Use an expression like this: @if(A[0] == 20 || A[0] == 24,A[0],255) Now following that, place a RasterBandNoDataSetter and set the NoData value to 255. What the ...


0

I am assuming that you are interested in interpolating the data into a raster (unless the points are already in a regular grid). You should import your data into ArcMap as a points layer using the add x/y data tool. Then you can interpolate the points into a raster using your z value with the IDW interpolation with spatial analyst. There are other ...


0

What you are looking for is the Cell Statistics tool. This can calculate the sum of a bunch of rasters. You can find it in the 'Spatial Analyst' - 'Local' toolbox. This tool can also work around NoData values in your dataset.


0

I am new to this too so I will not be able to help with prepackages solutions but from a programming perspective we have, 6000 binary rasters as independent files (species exists in pixel or not) (what dimensions X & Y?) each file contains an identical but irregular area of interest ( what size bounding box for area of interest?) ( are number ...


1

Depending on whether you want a mean or a spatially weighted mean there are a couple things you can do using the rgeos and raster packages library(rgeos) proj4string(grid) <- proj4string(nuts) # I assumed these were the same projection? First find out which grid cells intersect your NUTS polygons grid_nuts <- gIntersects(grid,nuts,byid = TRUE) ...


1

Your QGIS version (precisely the GDAL version it uses) was probably built without HDF5 support. QGIS automatically lists all subdatasets in a HDF5 and lets you chose which one you want to open when you import/open a HDF5 container. You can view all supported formats of your specific install by importing a Raster dataset (add Raster Layer) and using the ...


0

The Netcdf browser plugin you are using does not seem to work with the data, although the file ending suggests a netcdf file. See http://www.hdfgroup.org/projects/netCDF-4/ on the differences between Netcdf4 and HDF5. Possible duplicate of Getting warning when opening NetCDF file using gdal?. You need to run gdalinfo on the file to access the subdatasets ...


2

I would use a Con() statement in Raster Calculator. Something such as: Con("raster2" / "raster1" > 0.1, 1, 0) This will generate a new raster where values of 1 represent areas where raster2 is > 10% of raster1, and values of 0 is <10%


1

Using the WMS tile service from http://lasigpublic.nerc-lancaster.ac.uk/arcgis/services/LandCoverMap/LCM2007_GB_25m_V2/MapServer/WMSServer can load the Landcover tiles in with QGIS You can save out for local files or create vector file from raster using the grass tools (r.to.vect)


1

The CEH data is a single band greyscale Tiff that has an Esri .lyr file associated with it to style it with the appropriate colours. This is not the most straightforward option for this dataset but it is consistent with other datasets that have multiple colour schemes. Digimap now provide a QML file along with the Layer file to make the data more ...


1

How big is your dataset? You could create a fishnet grid in postgis See here Then you could interpolate your raster with your grid with various tools (gdal/qgis): see here Dont forget to index your grid to optimize speed. Good luck


0

You can get your desired data after making a free account on this website earthexplorer.usgs.gov You can download landsat7 as well as landsat8 satellite imageries from this site and can perform image classification in order to get required land cover.


4

You could use the raster Calculator something like (raster1>raster2>raster3)*1 OR (raster1>raster3>raster2)*1 OR (raster2>raster3>raster1)*2 OR (raster2>raster1>raster3)*2 OR (raster3>raster2>raster1)*3 OR (raster3>raster1>raster2)*3


2

Thanks for your feedback. I solved this by creating a second polygon around the entire raster extent, to which I assigned a value of zero. Previously, the shapefile only contained a single polygon, hence the cells outside of it had no value. Thus, the new shapefile and raster contain a value of 7.5 at the polygon and 0 elsewhere. (PS I am relatively new to ...


1

There are a couple of ways to make your contours smoother. Looking at the contours, I suspect it's because the IDW raster is low resolution. Did you use the default size (300x300) when creating this? Resize your IDW raster Probably the easiest way :- take your existing IDW raster and make it bigger with gdal warp (Raster > Projections > Warp). ...


0

Not sure why you're getting NULL values but the following code worked for me (note that I call the QGIS Zonal Statistics tool from the Processing plugin and I want to load the result): vectorlayer = qgis.utils.iface.mapCanvas().layer(0) rasterfile = qgis.utils.iface.mapCanvas().layer(1).source() processing.runandload('qgis:zonalstatistics', rasterfile, 3, ...


1

If raster fields are not supported for use in an update cursor (see parameter 2 'field_names') you could consider using the Calculate Field (Data Management) tool on your mosaic dataset via arcpy? I just tested on a custom field and it worked as expected.


0

In Settings -> Options, rendering tab you can select the three bands used for RGB rendering. It should be set to 1-2-3. It might be that some exotic Raster files have stored a different color scheme inside.


1

The best way to find out which layer is correct, is to set the project CRS to EPSG:3857 with on-the-fly-reprojection enabled, then load a Google or Openstreetmap background via the OpenLayers plugin, then add your layers and check their layer CRS. Then you see which layer ist placed on the right spot, and which might have a wrong CRS. BTW this page ...


1

This is just a guess, but I assume, its about the distortion inherent to your Projection EPSG:3574 which is extremal because displaying the pole(s). I guess there's only data in your raster layer until around 85°N or something, and you are trying to display data further north. You could try a projection that is "closer" to EPSG:4326 and then also first ...


1

Following on Vince's comment: you can remap your species to IDs that are powers of 2, as below, represented as integers and binary. Species 1 --> 1 --> 00000001 Species 2 --> 2 --> 00000010 Species 3 --> 4 --> 00000100 You can see that each species is identified by a 1 in a unique slot in the bit sequence. So for each species, you'd have ...


0

You will not be able to align these rasters in different coordinate systems especially since they are built from different datum. In the screen capture here, I have taken a raster with UTM projected coordinates and reprojected to GCS WGS 84. You can see the difference in linear shift of the corner of roughly 60m. Unless all of your rasters are projected in ...


0

Are the raster pixel sizes the same? If one is 3m and the other is 10m then there is no way that they can correctly overlap. I would look into that first. Second, if there is a common raster that you can clip it to outside of the ones you are using that shares that same cell size, then I would use that. Double check on the cell sizes to make sure that there ...


1

As you have reclassified this raster I'll assume that you have access to the Spatial Analyst extension, so will continue with instructions that require this extension. The tool you want to use is Con, although you can do it with Extract by Attributes Con gives you more control over the 'false' case. Your SQL statement has the potential to be quite long ...


1

Be sure to hit "Enter" as you are adjusting the values to "0" in the Reclassification tool. Sometimes if you don't it will just revert to "NODATA". That is a problem that I have ran into from time to time. If you want to leave the layer as a raster then it would be best to reclassify it, rather than to extract it using the extract by attributes tool, since ...


1

Use r.composite to merge the bands back into a single raster. This is the example from the documentation page: r.composite blue=lsat7_2002_10 green=lsat7_2002_20 red=lsat7_2002_30 output=lsat7_2002_rgb Don't forget to set your region!


6

Nice and reproducible question. Personally, I'd expect that the reason for the difference is in the implementations of the bilinear reprojection. You can obviously look into source code for the two approaches, but I'd expect that to be a vast overkill. It appears that the R implementation introduces bigger "errors" / "changes" than the raw GDAL version ...


2

Split raster does this, even keeps polygon geometry it chops single raster into bits and uses polygon geometry. Output base name is updated by seq.number, as always it is a 'bad' numbering i.e. image1, image2 etc while it should be image01, image02 etc if number of polygons > 9 and < 100. Would be helpful with sorting by name. Apart from this - great ...


3

I would use model builder for this. Use the feature iterator to cycle through each polygon and feed that into the clip raster tool. You would use in-line variable substitution to pass the polygon ID or unique name you used in the iterator to the output name of your new clipped raster. Here is the model: If you don't know anything about model builder, ...


1

You could use Zonal Statistics as Table to generate a table with a Unique ID field that can be used to join to the polygon buffer attribute table. The tool takes 1) a dataset that defines the zone (your buffer polygons), 2) a zone field (some unique ID field in the buffer polygons), 3) a raster that contains the values on which to calculate a statistic ...


2

Steven already shared a very good walk-through! I just want to add that you could also use the QGIS LecoS plugin (requires active numpy/scipy installation within your QGIS path) for this purpose. Especially for raster basic cleaning and edge extraction purposes. LecoS has a so-called landscape modifier since some time, which applies scipy's erosion ...


2

I'm not sure how well this will work without trying on your specific raster, but a few pointers. I assume from your image you used Threshold in GIMP to give you a binary raster (inside field/outside field) Removing noise You can use GDAL Sieve to remove the 'salt and pepper' noise - those little holes within the fields. You can do this from QGIS (Raster ...


1

extract pulls raster values out based on an intersection with a vector. That could be helpful if you wanted to sample raster values given something like a points shapefile. In this case, however, you want a to identify the cells based on value, and then get the data directly from the raster. This may need to be modified if performance in reading the data is ...


0

Do the averaging yourself? GDAL makes it very easy (especially with the python bindings) to read and write raster pixel data. Read your input files in chunks (if they are large), take the average (very easy with python as you can read the input to numpy arrays then just use numpy to take the average across a given axis), and write it out again.


1

GDAL is the most widely used library to access geospatial data from python. Unfortunately it can be a bit unintuitive from time to time. A recent development trying to make the use of GDAL more pythonic is rasterio import rasterio with rasterio.open('path/to/your/geo.tiff') as ds: ds = src.read()


1

With GDAL: from osgeo import gdal file = gdal.Open(’raster1.tif’) band1 = file.GetRasterBand(1) a = band1.ReadAsArray() In tiff you have 3 bands (RGB). So after you open raster file, you have to get band (1,2 or 3 are Red, Green or Blue) and then read band as array. Of course there could be only one band, but even then you have to get it before ...


3

You can use a Python numpy array and a .sum() operation to sum all of the floating point values in the array. ArcGIS has an easy interface to convert raster data to a numpy array by using RasterToNumPyArray (arcpy) # Import the arcpy site package import arcpy, numpy # Your input floating point raster raster = r'C:\temp\floating_point_raster.tif' # Convert ...


0

I haven't got ArcGIS to hand right now, but if you right click, select properties, and look under the general or source tab it might have a sum description, let me know if this doesn't help and I will look further. Gary


3

If I understand your question you would like specific values assigned to each resulting raster buffer. This can be done by simply assigning values via a index bracket assignment. First, create a raster with a polygon to buffer. library(raster) p <- spPolygons(rbind(c(-180,-20), c(-140,55), c(10, 0), c(-140,-60), c(-180,-20))) r <- raster(ncol=100, ...


1

Use the Lookup tool/function from the Spatial Analyst->Reclass toolset in your Raster Calculator expression. i.e using the CellStatistics tool/function to sum: CellStatistics([Lookup("rastera", "floatfld"), Lookup("rasterb", "floatfld"), Lookup("rasterc", "floatfld")], "SUM") i.e adding them up manually: Lookup("rastera", "floatfld") + ...



Top 50 recent answers are included