Tag Info

New answers tagged

1

maybe I get !! the quality of my raster image is fundamental. I had some steps to process it, raster to polygon, buffer + to involve some internal parts, buffer - to eliminate some external parts, polygon to raster ...


0

I think that I have figured out a way to do it. r <-raster(nrow=2,ncol=2) r[] <- round(runif(ncell(r))* 10,0) s <-raster(nrow=2,ncol=2) s[] <- round(runif(ncell(r))* 10,0) u <-raster(nrow=2,ncol=2) u[] <- round(runif(ncell(r))* 10,0) u = brick(u,r,s) u@data@attributes[1][[1]] <- values(u) At least in the toy example this does what I ...


2

If you would like to keep the object type(s) as raster I would take a look at the ratify function although, I do not think that it is intended for numeric data. require(raster) r2 <- raster(nrow=10, ncol=10) r2[] = 1 r2[51:100] = 2 r2[3:6, 1:5] = 3 r2 <- ratify(r2) rat <- levels(r2)[[1]] rat$MyRATValue <- c(100,200,300) ...


1

ENVI can handle this directly. there is a layer stacking tool (Basic Tools > Layer Stacking) to create composite bands.


1

(Disclosure: I am part of the WOUDC data centre renewal team) The data centre is undergoing renewal in order to modernize client services. Improved data access is one of the major enhancements (which includes geospatial web services and formats; see the data access about page for details). Users are encouraged to provide feedback against the beta. For ...


0

I just refactored your code so all the plots show on the same graph. Also you had a couple of little typos and pep8 issues from scipy import interpolate import matplotlib.pyplot as plt bins = range(0, 100, 10) gd_hist = [1, 2, 3, 4, 5, 4, 3, 2, 1] bd_hist = [2, 4, 6, 8, 10, 8, 6, 4, 2] nPixels = len(gd_hist) # here we are creating the cumulative ...


2

Do not use the regular "Add PostGIS Layers", it will not show your raster table. The plugin "Load Postgis Raster to QGIS" was not updated to QGIS v.2.0, so it won't work either. In QGIS v.2.6 go to menu Database->DB Manager->DB Manager, set the database connection and you will see the raster table. You can drag and drop it or right click and select Add to ...


0

As the error message states, you cannot have an attribute table for a multi-band raster. The attribute would be tied to the combination of all three bands, not just a single value. I'll also point out that the raster must have integer values - float or double won't work. Be careful with input data types (may have to be converted) and any choices made along ...


4

The following script determines the bounding box of a raster and creates based on the bounding box a geometry. import ogr, gdal raster = gdal.Open('sample.tif') vector = ogr.Open('sample.shp') # Get raster geometry transform = raster.GetGeoTransform() pixelWidth = transform[1] pixelHeight = transform[5] cols = raster.RasterXSize rows = raster.RasterYSize ...


0

why don't you use a Basemap as the background layer? (if you are working in ArcGIS). For the boundary lines it should be also very easy to find that. There are several shapefiles out there, just google for Istanbul shapefiles.


2

Since 10.1, you can use the image analysis tools (Windows > image analysis) to create a mask function that will perform the masking on the fly Using the Mask function, you will specify one or more NoData values or a range of valid pixel values. The inputs for this function are the following: Input Raster / NoData Interpretation / NoData ...


0

If the class breaks were derived from the rasters rgb values, you might use arcpy.GetCellValue_management tool with the features centroid against the original raster? Saving polygon symbology as RGB values in the attribute table


1

A non-ESRI option might be to use GDAL. The nearblack tool will convert nearly black or nearly white pixels to all black or all white. Though, again, this doesn't meet your requirement to not create duplicate files.


5

Looks like you downloaded the JPEG "LandsatLook images with Geographic Reference" not the "Level 1 GeoTIFF Data Product". JPEGs use lossy compression which will change the values slightly so the zero values at the edge of the scene aren't exactly 0 anymore. You can use GDAL nearblack (QGIS Raster - Analysis - Near black) to convert them back to 0 (output to ...


1

Your best bet is to convert it to JSON. I assume the binary array is a file type, so you have a X,Y,(Attribute) grid in some format and you want to display it on Leaflet. If you have a way of reading the file, then work out how to output it just as points, so CSV, or GeoJSON as a first preference. If there are less than, say, 3000 points, that will render ...


1

I ended up using an R solution almost identical to that provided by @JeffreyEvans. First, I was able to pare down the number of polygons of my shapefile I was genuinely interested in. I pared these data down by eliminating those polygons that were outside of city limits in the county in which I was interested. This was a simple process done in QGIS to ...


2

There are a number of assumptions in your question which need to be addressed before you get to the implementation question. The example you provide is a biodiversity analysis that is based on a sample of varieties of a given plant species. I looked at the manual for the software that was used to generate this raster, and there is no indication that this is ...


3

For irregular polygons, and assuming that your geotiff raster file is a binary raster, you could use GDAL_Calc: GDAL_Calc.py -A Mask.tif -B CutBigImageToClip.tif --outfile=SmallerFile.tif --NoDataValue=0 --Calc="B*(A>0)" This query will populate 0 where Mask.tif <= 0 and BigImage where the Mask > 0. To do this both rasters must be the same cell ...


1

I don't know if it's possible to clip a raster with an other raster but you could use gdaltindex to build the shapefile with the extent of your raster. http://www.gdal.org/gdaltindex.html


1

Multiply your float raster by 100, add 0.5, run Int, and divide by 100 to round to the nearest hundredth. For example, if your floating point value was 1.629 and you want to round to two decimal places, multiply by 100, and add 0.5, which leaves you with 163.4. Run Int, which truncates the value, leaving 163. Divide by 100, leaving 1.63, the desired value.


1

You should add exact info about the current situation to the question. Such info can be obtained from the gdalinfo report http://www.gdal.org/gdalinfo.html, from the image layer properties that QGIS is listing (Layer properties - Metadata - Properties) or by listing the GeoTIFF tags with the listgeo utility http://www.remotesensing.org/geotiff/listgeo.html. ...


0

GDAL is the software component used by QGIS to open rasters. The georeferencing data is normally embedded in the GeoTIFF file, however (from GTiff): If no georeferencing information is available in the TIFF file itself, GDAL will also check for, and use an ESRI world file with the extension .tfw Essentially GDAL is only using the georeference data from ...


2

The use of world files pre-dates GeoTiff, I can remember using World Tiff images in the 90's back when JPEG was a new and misunderstood format, there was no GeoTiff, I can't remember the exact year but it would have been around 2002 when I first heard of software using the 'new' format that didn't need a world file. Some software still doesn't support ...


2

To determine what the river currently is outside the existing river use Euclidean Allocation to 'spread' the value of the river out. Then add the river rise value and select cells less than that: RiverSmear = EucAllocation(Rivers,Arbitrary_Distance,RiverElevation) RiverRise = RiverSmear + HowHighTheRiver NewRiver = Con(DEM < RiverRise,1,0) If you don't ...


0

When faced with a problem like this I use os.walk() which returns all files and then see if the files match what I want by extension, here's an example for shapefiles: import sys, os, arcpy InFolder = sys.argv[1] for (path, dirs, files) in os.walk(InFolder): for ThisFile in files: fName,fExt = os.path.splitext(ThisFile) if fExt.upper() ...


2

If you know the coordinate values of the north, south, east, and west edges of the grid and the number of rows and columns, then you can calculate the row and column of a known x,y point (your weather station) using the following equations: row = Math.round((numberRows - 1) * (north - y) / (north - south)) column = Math.round((numberColumns - 1) * ...


1

I resolved the issue by importing all my ZMAP files into another piece of software (Petrosys) and re-exporting them as ZMAP files. All the files now load correctly into QGIS 2.4. I'm not sure if this is an export issue from the original software (formats between files appeared identical) or a QGIS import bug? Either way Ive' found a workaround. Thanks.


3

As discovered in the comments, one row (value = 21) was selected before running Reclassify. The Reclassify tool only considered the selected row, therefore only reclassified those pixels where value = 21, to the new value, 2. Edit: it may be worth noting that there is no mention of whether Reclassify respects selections in the help page. I would be ...


1

You can go to geoserver administration page, go to Style memu and then edit that sld style. There should be tags like <name> and you can change it.


1

It would help if you provided some sort of debugging result from when you load your map. I know that you can get the console up on firefox with ctrl + shift + k. Then jump to javascript tab (because thats where errors happend to me) and you can find your error there. Usually the infinite loading icon means there is an error. And yes you should create ...


1

Yo uhave the municipality boundaries a a shapefile, and your jpeg has "homogeneous" values inside each municipality. Therefore, the best method to get your values is tansfer the values of eac band. It is easy if you have spatial analyst licence: 1) feature to point with the "inside" option to build the centroid (or add XY fields and make XY event layer if ...


0

Ok, I figured it out. I can just create a polyline, make sure it remembers z values and do a stack profile with the "stack profile tool". It stored my data in a table which I could export into Excel. Did it for all the different rasters. Worked like a charm. Many thanks anyway!


1

Did you look at all the APIs that come with Oracle Spatial Georaster ? One of them is a Java API that lets you manipulate rasters. See the oracle.spatial.georaster package in http://docs.oracle.com/database/121/SPAJV/toc.htm


0

You need to select the polygons sharing a particular species before running polygon to raster, and have to repeat the operation for each species. Geoprocessing tools should honor selections for inputs, so the resulting raster will only be for one species. Depending on how many you have and how often this might be repeated, you might want to consider building ...


2

Building on FelixIP's answer, the following method checks for 1) zero values in a 200x200m area located at the center of the image and 2) corrupt rasters that will not read. The bad files are added to one of two lists based on the problem. Efficiency is good, with the script scanning ~2 tiles/sec. import arcpy, os, numpy arcpy.env.workspace = ...


2

Replace point coordinates below by raster extent centre point coordinates p=arcpy.Point() with arcpy.da.UpdateCursor(pntFile,("SHAPE@XY",theFLD)) as rows: for row in rows: XY=row[0] p.X,p.Y=XY myArray = arcpy.RasterToNumPyArray(raster,p,1,1,-9999) ...


0

You need to change your %Temp% directory, it's trying to save the temporary result of the Con operation to your user folder (C:\Users\User\Documents\Mo Correll\ArcGis\) where is something like xx001258 and tripping over the space in your user name. Make a folder on your 'c' root called MoTemp or something like that and set your temp and tmp environment ...


1

I am new to PyQGIS and was actually looking for a solution to the same question: why is setColorShadingAlgorithm not working. However I do have an answer for your first question, how to calculate the min and the max values of a raster layer. There's for sure an easier and cleaner way to do it, but I've been doing it using the gdal library: from osgeo import ...


5

I'd really give SpatiaLite a go for getting this done! Most conveniently you could use the QSpatiaLite plugin in QGIS. Just set up a polygon grid with a sensible size for gridcells. Then intersect the grid with the ethnic group's polygon and calculate area of each intersection. With the resulting table you can calculate your indices by using the ...


0

I would (providing the TAB and tif files have exactly the same cells): extract the centre of each tif pixel as an xy coordinate write the xy file to csv (1. & 2. can be done together with gdal) read the xy file and TAB files into a program (R/python/whatever) stack the TAB file columns join/merge/rowbind the xy and TAB files and export to xyz read the ...


3

In QGIS, you could generate a point grid on top of your polygons. You'll find this function under Vector -> Research tools (I think it's called that in English, my QGIS version is in another language.) You'll have to find some reasonable granularity when it comes to the point grid spacing. Then under the Vector menu, you do a Join attributes by location ...


1

Referencing the question you linked. This code should work for ya: import arcpy fOut = open('outputFile.py', w) # Open output python file fOut.write('Dict = {' + '\n') # Write the dictionary rstArray = arcpy.RasterToNumPyArray(rasterFile) # Change rasterFile to numpy array rows, cols = rstArray.shape # ...


1

The problem is due to the presence of non-ascii characters in the path of the output file, so you just change the path name to something else that contains ordinary characters (e.g. UTF-8) and try again.


5

I doubt your process "gets caught in a loop", I think it will just take a long time to complete as your rasters are actually quite large. Those "small rasters totally less than 100mb" are roughly 2Gb uncompressed, each. The layer properties you included in your question show that particular raster has dimensions of 36702 cols, 14147 rows and 4 bands with ...


0

Still in QGIS 2.4 there are no focal statistics, i.e. filters, per se, and I do not think that there will be any in the future. However, SAGA can be reached via the Processing tool box. In the SAGA command list you can choose Grid - Filter and then you have plent of a choice. I suggest using the "user defined filter" if you know what you are doing or the ...


1

The tool to do this is called cell statistics Select the option SUM In the environments setting (Output Extent) set the output extent to intersect


1

Raster Calculator can do this -- indeed, the example illustration on the help page shows exactly what you want to do. The resulting raster will only cover the overlap area, which I often find problematic for my analyses but sounds like what you need. Other options would work but are more complex than you need. The Plus tool only adds two rasters at a time ...


1

ECW comes from Erdas and is not fully supported by GDAL without Erdas licence. According to the help : The ECW 4.x SDK from ERDAS is only free for image decompression. To compress images it is necessary to build with the read/write SDK and to provide an OEM licensing key at runtime which may be purchased from ERDAS. So you can decompress your ...


0

You will need the Spatial Analyst extension installed and licensed. If you do not have this then you will not be able to do the raster calculation. If you do not have the Extension then you could use other software like Whitebox GAT. In ArcGIS you would convert your vector data into a raster format using this tool, note you can set cell size. Then you would ...


2

I am late here, but this question was my entry into the forum as I was researching the same question. I think that the original poster may want to calculate for each cell the height above the first stream cell that would be reached by water flowing from the cell. So the 'nearest stream' is calculated along the downslope flow path, not euclidian distance. ...



Top 50 recent answers are included