Tag Info

Hot answers tagged

5

Try converting your rasters to numpy arrays and then check to see if they have the same shape and elements with array_equal. If they are the same, the result should be True: import arcpy, numpy raster1 = r'C:\path\to\raster.tif' raster2 = r'C:\path\to\raster.tif' r1 = arcpy.RasterToNumPyArray(raster1) r2 = arcpy.RasterToNumPyArray(raster2) d = ...


3

You could have a try with gdalcompare.py script http://www.gdal.org/gdalcompare.html. The source code of the script is at http://trac.osgeo.org/gdal/browser/trunk/gdal/swig/python/scripts/gdalcompare.py and because it is a python script it should be easy to remove the unnecessary tests and add new ones to suit your current needs. The script seems to do pixel ...


3

No the API is fine what is happening is Python is seeing \n and treating it as a new line which is what \n means. You will need to put a r in the front of your string. (r"c:\yourpwth")


3

As Pat has mentioned, you cannot merge different geometry types together, just as you cannot merge polygons and lines together, or points with polygons. Your question needs to be edited to provide more information as to what you are hoping to do, or have as an outcome. If you have if you want to merge two datasets together to get more area, then convert the ...


2

There is two ways: you can transform the raster to vector and then merge the two vectors. you can extract the centroid of the counties and then extract the values of the raster in this points.


2

The mask function is doing exactly what is is supposed to do. mask assigns all pixels outside of your polygon area of interest as NA. Specifically, any pixel center that falls outside of the polygon gets reassigned NA. You can see that areas specified in your figures are areas where the pixel centroids are outside of the polygon. To improve the ...


1

If I have understood your question correctly you have created a raster which is an NDVI of your area of interest and you want to create a graph of area versus NDVI value, is this correct? Your NDVI raster will be of type float and with therefore not have an attribute table. You could multiple this up by say 1000 to move the decimal place and convert to an ...


1

I would suggest that you build your raster attribute table for each image, then you can compare the tables. This is not a complete check (like computing the difference between the two), but the probability that your images are different with the same histogram values is very very small. Also it gives you the number of unique values without NoData (from the ...


1

I would use Tabulate Area (Spatial Analyst) rather than Zonal Statistics if you are after proportions. import arcpy from arcpy import env from arcpy.sa import * env.workspace = "C:/sapyexamples/data" TabulateArea("zonedata.shp", "IDStr", "valueraster", "VALUE", "C:/sapyexamples/output/areatable.dbf", 2)


1

This doesn't sound like an application for the raster datatype. I think what you really want is to use Create Fishnet (Data Management) to generate a vector which will overlay the other data. I would caution you about the use of such a tiny fishnet size. Unless your data is of submillimeter precision over a small area (as in an archeology dig), five ...


1

The easiest way is to subtract one raster from the other, if the result is 0, then both images are the same. Also you can see the histogram or plot by color the result.


1

I noticed I could define the extent in the properties of the layer, export to layer file and then to .tif in ArcMap, so figured there would be a layer python command to make this in memory. Use "gp.MakeRasterLayer_managment" to make a temporary raster layer with the extent set to be the desired file extent. export the layer with gp.CopyRaster_management to ...


1

the best way is to use vrt (virtual raster template). with gdalbuildvrt you can extract each band in a single vrt file using the -b option. Then you concatenate into a single stacked image using gdalbuildvrt -separate . If you wish, you can then create a tiff file using gdaltranslate (with the -co TILED=YES option), but this is not necessary as QGIS reads ...



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