Tag Info

New answers tagged

0

I also needed to know how to rename bands in an open source environment so spent a whole day looking for answers. There is no way to name bands in QGIS while merging. But it can be done after the file is created, by editing their .aux.xml file. It works for both .tif and .img files, as far as I've researched. The solution is to include after each ...


0

I'd look at the GDal bindings for C#: http://trac.osgeo.org/gdal/wiki/GdalOgrCsharpRaster. There are a couple example files in C# on that page for dealing with rasters. gdalnumeric.LoadFile(path) returns an array that you can use to access individual cells. But I believe that gdalnumeric is a python only library.


0

You could look at SAGA GIS that can be called from the command line. See SAGA CMD for further details


3

Previously I have saved as a layer file and then imported the symbology from the layer. To save as a layer file right click on the layer in the table of contents and select 'save as layer file'. To import the symbology click on the open folder in the raster properties dialog. then browse to the layer file saved to disc Note: if the layer symbology is ...


1

Softree Technical Systems has been working with the University of British Columbia's Mathematics Department on vertical alignment and earthwork optimization technologies. See: http://www.publicaffairs.ubc.ca/2012/12/18/revolutionizing-road-design/ Please refer to our website http://softreeoptimal.com/ for further details or send me an email at ...


2

you can use raster calculator to set your 0 values to NoData. Con(condition, value if true, value if false) will set the false value to Nodata if it is left blank. in your case, you could use Con(raster== 1, 1) a more generic code would be Con(raster!=0, raster) when you convert to polygon, NoData pixels will be ignored. Note that you can make ...


2

It doesn't look like your code properly saves/closes the dataset. To do this, add this to the end: dst_ds = None # save, close Also, although it looks like you want to use -999 for NODATA, this needs to be set to the resulting band. If you want to learn more about raster processing with Python, check out rasterio.


0

Without having gone through your code just a suggestion: NDVI is an index and results are between 0 and 1. you will probably work with 8-bit Tiff which stores values between 0 and 255 so if you multiply your results by 100 it should work ndvi = np.where ( check, (nir - red ) / ( nir + red ) * 100, -999 )


0

There are at least two formats with .grd/.gri extension. One is Golden Software grid - GDAL can easily handle it, so simply open it through Add Raster Layer, as Didier Blavet suggested. But there is also DIVA-GIS grid format. I found a maillist entry saying that only DIVA-GIS can open it. So you have basically two options: you can get and install DIVA, open ...


0

I made a version of WorldFileTool (which I'll call 0.3.8 because the project seems dead) that supports CLI input and can be included as part of a GDAL script: 0.3.8 WorldFileTool jar package download link (personal build) Modified source code tarball (based on subversion repository) Command line argument: java -jar WorldFileTool.jar ...


1

The difference is only due to the symbology, your original raster is symbolized with a classified method and bilinear interpolation resampling. I don't know what's used to symbolize the second one, maybe just pixel values or classified with nearest neighbor resampling. You can manage this in ArcGIS using the Symbology and Display tabs of the layer ...


1

For GRASS you can use the r.colors to modify the color table for a raster map. r.colors also ships with pre-defined color maps for temperature scales. It's simple to use even r.colors map=spring color=celsius You can also copy the color table from one map to another r.colors map=spring2 raster=spring For more details see the GRASS GIS manual ...


0

I could not find a way to do this in Grass, but it is possible in SAGA. Here is a brief recipe: 1) After you import the TIFF file into the project 2) you can go to the Properties panel in the Setting tab and lookk for Colors->Type->Scaling->Value Range You can see something like Value Range 5:15. 3) Click in the text box and replace those values with ...


1

If you're sure your coordinates are exactly in the center of the cell, you could get the raster cell size using Get Raster Properties and add 1/2 CELLSIZEX to the X coord and do the same with CELLSIZEY for the Y coord.


0

I found the solution - and it was only one or two things that were missing. In the python script I needed to add: - if outRas is not None: arcpy.AddWarning("Made a new raster") tempFile = os.path.join(arcpy.env.scratchGDB, "wibble") arcpy.AddWarning(tempFile) outRas.save(tempFile) arcpy.SetParameterAsText(1, tempFile) #THIS WAS MISSING Then ...


0

We were so much worried about our DEM image it was also not aligned to the supervised classified raster image. We have also used the method of "Matthew Long". we have added the snapshots of non-aligned and aligned images. Again we are very much thankful to Matthew Long for providing their suggestion. After the method by Matthew Long our DEM image was ...


2

For the Mercator projection, the extent can not reach North and South pole for mathematical reasons. The standard Google and Openstreetmap mercator projection is limited to 85.011° North and South to get a square map. See http://wiki.openstreetmap.org/wiki/Slippy_map_tilenames#X_and_Y for explanation. Using EPSG:3857, the extent of a map is ...


2

I just did some basic tests, converting a raster to a binary mask by performing a Con, which created an 8-bit output. From there, I could use Copy Raster to convert the output to a 1-bit raster: arcpy.CopyRaster_management("in_raster", "C:/workspace/foo.img", "", "", "", "", "", "1_BIT") I confirmed that ArcGIS and GDAL both see this as a 1-bit raster. ...


0

you can use gdal to do this if your input data is georeferenced, with gdalwarp you will need to specify the output size (-tr 1000 1000), the resampling method (-r bilinear) and I guess the projection of MODIS as output ( -t_srs "+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs" ) so it should look like this in command line ...


3

A successful workaround was to create a new file geodatabase, and write the mosaic image to this - the gap is now gone, with no other changes to the code. This may be a bug, or perhaps there's a problem with using PNG files as the output?


2

Join points and ploygons by location and continue your analysis with the join result. The join will append point attributes to the polygons inside which the points are located. Polygons which do not contain any points will have NULL values.


0

A couple of thoughts: If you're using ArcGIS Server for custom raster based services, definitely checkout the Image Service. You put your rasters in a Mosaic dataset, then publish THAT to the server. You can then attach predefined raster functions which correspond to those of Map Algebra / Raster Calculator. ...


3

A couple of options: Convert the PostGIS layer to a shapefile in QGIS (save-as), then use the Vector|Conversion|Rasterize tool; Use the gdal_rasterize command directly. For the second option: gdal_rasterize -a VAL -ts [x] [y] PG:'host=localhost dbname=DB user=USER' -sql "SELECT the_geom, VAL FROM table" out.tif Where: VAL = the value to assign ...


1

You could try the Rasterize tool in QGIS (Raster - Conversion)


0

Sounds like you may have reached the "Maximum Number of Points" limit. By default this number is set to 1500000 but you can increase it. (it is an option in the Raster to TIN) dialog


2

The following is a model builder approach in ArcGIS which will delete all rasters where all cells are nodata.


0

The approach I ended up using is the following: I buffer the forest stands, which are represented as centroids (green dots) in the image above. I create a fishnet grid over the entire area of interest. I determine for each fishnet grid cell, how many timber stands are within that grid cell. I determine the grid cell with the highest number of stands ...


1

This can be done with open source tools via gdal_translate: for %i in (*.tif) do gdal_translate -a_nodata 0 %i %~ni_NODATA.tif The OSGeo4W Shell command is very simple and will create new raster data without NoData around images. gdal_translate: hide nodata - video


1

Define your area of interest with all the cells to be filled and a reasonable amount of neighboring cells, either raster or geometry and use extract by mask to smaller sample to reduce the processing time. Convert the extracted raster to point using raster to point (this will ignore the null cells). From the derived points create either a TIN or Terrain ...


1

While there is some degree of convergence happening between GIS and civil engineering CAD tools, you are probably much better off with the latter type of, much more specialized, tool. Some examples of suitable civil engineering CAD tools: Softree's RoadEng is very good (I worked on it briefly) and relatively low-cost. Autodesk's (AutoCAD) Civil 3D is ...


0

If your script knowledge is limited have you considered doing this in model builder? The model below will identify the minimum cell value and extract all cells with this value to a new grid.


1

You can use Get Raster Properties (Data Management) to extract minimum elevation values. import arcpy inputRaster = r'C:\temp\dem.img' raster = arcpy.GetRasterProperties_management (inputRaster, "MINIMUM") To extract the information so that you can use it in a command such as Con or Reclassify use the following: elevMin = raster.getOutput(0) To put ...


3

I recommend creating a mosaic dataset within a file geodatabase. There are many advantages of working with this type of data model. For one, you can modify properties of the dataset once it is created to enhance rendering. You also have much finer control of how these data are served compared to a stand-alone raster dataset created using mosaic to new ...


0

I think I had to post this question to solve it... I clipped the first raster with my vector layer and used it to make a mask with either 1's ou 0's. I then multiplied this mask with every raster one by one.


0

Try building a virtual raster and pyramids from the original. Qgis should then only load the visible part into memory. See http://osgeo-org.1560.x6.nabble.com/gdalbuildvrt-setting-scale-dependent-visibility-td5095071.html for details


0

Try converting your file to another/the same format (Raster/conversion/translate(convert format).There you can define a value for "no data", which you can set to a number different than 0. Hope it helps


1

Raster was loaded properly in Postgis with overviews but qgis plugin "Add a Postgis Raster layer" can't handle this file due to the size (10GB). However, I was successful in adding a subset of that raster whose size was comparatively very small. QGIS displays that raster correctly. I have tried raster having maximum 3GB size. If anyone has succeeded with ...


1

I assume that you are using the GDAL Rasterize (vector to raster) tool. Using QGIS, you can edit the gdal rasterize command and had the "xmin ymin xmax ymax" parameter: Notice that you will have to adapt the coordinates to fit your case. You can use this same command directly on the console or terminal to bash rasterize all your vector in one go. You ...


1

255 is the default NoData value in QGIS. I am not sure, what exactly the problem is with the way you tried it, but you could use the GDAL Python bindings to do what you want. For instance the following script converts your shp to a polygon based on the attribute NAME_2_NUM. Import the libraries import ogr, gdal, osr Open your shapefile source_ds = ...


0

I'm not sure how this could be done in ModelBuilder without creating an intermediate raster or zonal layer as was suggested. However, it is pretty straightforward in python. Maybe there is some way to add a python script into the ModelBuilder flow. I haven't done that before, so I can't say. Here is an example of how the two steps would be carried out in the ...


2

The "extract" function in the raster package will extract raster values to points for a stack or single raster.


0

Thanks for your fast answer. The extent() function does not work for me. I still get the same error. But I am sure the 2 datasets overlap! With the extract(raster, poly_shape) I get the right data from it. Just as a list and not as a raster like I want to have it. I just loaded the datasets in ArcGIS before and they fit very well so I did not check the ...


0

If you run Zonal Stats (max) this will "fill" your zone with that maximum value. In a second step you will then need to ask the raster calculator: Where is the Zonal stat grid equal to the original grid? Or something like: [zonal_out] = in_raster This will give you the pixels with the max values as calculated from the zonal stats tool.


4

The extract function is behaving exactly as it should. You can force the crop function to use the extent of the polygon and then mask the object to return the exact raster representing the polygon area. If you continue to receive the error it means that your data, in fact, does not overlap. Please keep in mind that R does not perform "on the fly" ...


3

Rightclick on a layer, and check Update Drawing Order. Prior to QGIS 2.0, this was part of the Table of Content. Sometimes it helps to save and open the project again.


0

I have no problem with the speed of the calculation with the function rasterize: library(raster) ## Set up a raster #Extent ext <- extent(munisCrop.shape) #Resolution xy <- abs(apply(as.matrix(bbox(ext)), 1, diff)) r <- raster(ext, ncol=xy[1]/0.1, nrow=xy[2]/0.1) ## Rasterize the shapefile #you need to define the the value(s) to be transferred ...


1

You can always use a tool's batch functionality--just right-click on the tool > batch... and fill in the blanks. However, this type of operation is typically done in an automated fashion. You do not have to create individual shapefiles from features in a shapefile. Instead, you can use a Search Cursor to access all of the features in the FC. This is ...


0

This answer is not intended for beginners to ArcGIS. Having some knowledge of Model Builder, especially iterators would be best. I would use ModelBuilder to iterate through your shapefile directory, and run a clipping process. If you have spatial analyst, I would recommend using Extract By Mask. If not, you can use Clip, but you'll need to do an extra ...


1

I suggest using the Point to Raster tool. With default settings, it chooses one point per cell to generate raster values. Using the cell_assignment option of COUNT, however, the raster stores how many points occurred in each cell. This produces new rasters rather than working with existing ones, but the process of combining rasters for analysis is simpler ...


1

Using any of the tools you mentioned you can preprocess the points so that one feature (with a count) occurs in each raster cell. Converting that to a raster using the standard built-in method completes the task. The advantage of this method is that it provides complete control over the conversion process, so you know exactly what is happening. Moreover, ...



Top 50 recent answers are included