POST
|
Hello I need to build a model in ArcGIS model builder. I know the extension is available for this purpose but i need to build model. Can some one give me with that, just some clues. The data set: 1. Land use for 2014 2. River network 3. Drainage network 4. Hospital location 5. Kindergarten location 6. School location 7. DEM 8. Population distribution 9. Employment 10. Earthquake zonation 11. Flood zonation
... View more
06-09-2015
01:42 AM
|
0
|
3
|
3703
|
POST
|
Yes Xander Bakker you are wright i don't know much about Numpy, i need some guide book...
... View more
01-29-2015
09:09 PM
|
0
|
0
|
536
|
POST
|
I am want to calculate repetitive values from raster and save it into dict, how can i do it ? i have done some coding but its not working help me to solve the problem. below is my code: import numpy as np import arcpy from arcpy import env env.workspace = r"D:Results" rasterlist = arcpy.ListRasters() array = arcpy.RasterToNumPyArray(raster,nodata_to_value=0) array1 = np.reshape(array, (1,np.product(array.shape))) mydict = {} for i in array1: if i in mydict: mydict += 1 else: mydict = 1 print mydict Actually i want to implement the following formula: where g is the number of tied groups and tp is the number of data in the pth group. For example, in the sequence {23, 24, trace, 6, trace, 24, 24, trace, 23} we have g = 3, t{ = 2 for the tied value 23, t2 = 3 for the tied value 24, and r3 = 3 for the three trace values, where as n = 1
... View more
01-29-2015
07:33 AM
|
0
|
5
|
6236
|
POST
|
I tried this method but i get error, one problem more, the spatial extent of output raster is different, mean height is different but mean cell width is same, i don't understand ?
... View more
12-30-2014
11:11 PM
|
0
|
1
|
368
|
POST
|
Xander Bakker ,The Menn Kendall test is non-parametric test, use to find the trend of data either increasing, decreasing or remains same. I just want to find the trend, And what is wrong with my code is it not understand able ? I also wants to add these save rasters to one raster, and assign the projection of original raster, Where should i change the code ?
... View more
12-29-2014
10:50 PM
|
0
|
3
|
1953
|
POST
|
I will post it when it will be complete, half done yet... The half code....Dan Patterson, please check it... import arcpy import numpy from arcpy import env import numpy as np arcpy.env.overwriteOutput = True env.workspace = r"D:\PythonProject\Data" rasterlist = arcpy.ListRasters() for raster in rasterlist: print raster n = len(rasterlist) pairs = (n * ( n - 1)) / 2 print "Pairs to be formed: ", pairs def pairsRasters(raster1, raster2): print raster1, " - ", raster2 desc1 = arcpy.Describe(raster1) desc2 = arcpy.Describe(raster2) nameRaster = desc1.basename + " - " + desc2.basename #print nameRaster array1 = arcpy.RasterToNumPyArray(raster1,nodata_to_value=0) array2 = arcpy.RasterToNumPyArray(raster2,nodata_to_value=0) #print "\n ", array1.shape # to see how many dimension the array has (height, width) = array1.shape newRaster = numpy.zeros([height, width]) for row in range(height): for col in range(width): #print "Row, Column: ", row, col #print float(array2[row][col]), float(array1[row][col]) #print (float(array2[row][col]) - float(array1[row][col])) newRaster[row][col] = np.sign(float(array2[row][col]) - float(array1[row][col])) finalRaster = arcpy.NumPyArrayToRaster(newRaster) outname = "D:/PythonProject/Outputs/" + (nameRaster + ".img") #arcpy.CopyRaster_management(name, outname ,"DEFAULTS","0","9","","","8_BIT_UNSIGNED") finalRaster.save(outname) for current in reversed(rasterlist): for previous in rasterlist: if current == previous: pass elif current > previous: pairsRasters(current, previous) else: pass
... View more
12-28-2014
02:27 AM
|
0
|
5
|
1953
|
POST
|
Thanks Dan Patterson, for help, i have bug in my program, but i find it successfully...
... View more
12-27-2014
11:05 PM
|
0
|
7
|
1953
|
POST
|
what would be value if it's (5 - 9), is it -1 or -4 ?
... View more
12-27-2014
03:43 AM
|
0
|
9
|
1953
|
POST
|
Hello Guys, I need to perform Mann Kendall test on 5 series raster data yearly basis, from 2007 to 2011. if need to iterate pixel by pixel on raster cell values for calculating the sign. How can i do it... Below is code but i have problem with numpy... import arcpy
import numpy
from arcpy import env
env.workspace = r"D:\PythonProject\Data"
rasterlist = arcpy.ListRasters()
for raster in rasterlist:
print raster
n = len(rasterlist)
pairs = (n * ( n - 1)) / 2
print "Pairs to be formed: ", pairs
def pairsRasters(raster1, raster2):
print raster1, " - ", raster2
inRas1 = arcpy.Raster(raster1)
lowerLeft1 = arcpy.Point(inRas1.extent.XMin,inRas1.extent.YMin)
#cellSize = inRas.meanCellWidth
my_array1 = arcpy.RasterToNumPyArray(inRas1,nodata_to_value=0)
inRas2 = arcpy.Raster(raster2)
lowerLeft2 = arcpy.Point(inRas2.extent.XMin,inRas2.extent.YMin)
#cellSize = inRas.meanCellWidth
my_array2 = arcpy.RasterToNumPyArray(inRas2,nodata_to_value=0)
for current in reversed(rasterlist):
for previous in rasterlist:
if current == previous:
pass
elif current > previous:
pairsRasters(current, previous)
else:
pass Suppose the two raster of similar extent, i need to calculate difference, if it's greater than 1 the value store in output raster would be 1, if less than 1 the value would be -1 and else zero. How can i iterate on pixel by pixel of two rasters. so i can save it into new raster. That's it.. Column 1 Column 2 Column 3 Column 4 Column 5 50 25 98 102 98 122 98 10 210 100 57 66 92 21 10 98 45 255 9 59 58 98 17 31 54 Message was edited by: Ahsan Abbas
... View more
12-27-2014
01:09 AM
|
1
|
12
|
7949
|
POST
|
Yes it's works, It's true only for the case of both polygons have same no of points, other wise it's index is out of bound problem... Well thanks for help...
... View more
12-24-2014
10:32 PM
|
0
|
0
|
878
|
POST
|
Actually i don't understand how your point in polygon code helps me, you need to tell, what is problem in my code. ?
... View more
12-24-2014
02:16 AM
|
0
|
2
|
878
|
POST
|
I want to calculate the intersection point of two polygon, the polygons are illustrate in picture. The picture clearly show that there are two points of intersections. I have write some code, but there is problem init, it's calculate more than two intersection point. Blow is my code... def linesIntersection(A, B, C, D): x1 = A[0] y1 = A[1] x2 = B[0] y2 = B[1] x3 = C[0] y3 = C[1] x4 = D[0] y4 = D[1] #print x1, y1, x2, y2 #print x3, y3, x4, y4 denomenator = (((x1-x2)*(y3-y4)) - ((y1-y2)*(x3-x4))) #print denomenator if denomenator == 0: return denomenator else: P1 = (((x1*y2 - y1*x2)*(x3-x4)) - ((x1-x2)*(x3*y4-y3*x4))) Px = P1 / denomenator P2 = (((x1*y2 - y1*x2)*(y3-y4)) - ((y1-y2)*(x3*y4-y3*x4))) Py = P2 / denomenator print "The Intersection points are: ", Px, Py polygon1 = [(1,0),(3,0),(3,2),(1,2),(1,0)] polygon2 = [(0,1),(2,1),(2,3),(0,3),(0,1)] poly1 = len(polygon1) poly2 = len(polygon1) #print poly1,poly2 for i in range(poly1-1): A = polygon1 B = polygon1[i+1] for j in range(poly2-1): C = polygon2 D = polygon2[j+1] linesIntersection(A, B, C, D) I am using determinant for calculating the intersection of point. http://en.wikipedia.org/wiki/Line%E2%80%93line_intersection There is a condition both lines should be similar planes, this is where problem begin, i don't know how to do it ? Pleas help me...
... View more
12-23-2014
10:04 AM
|
0
|
6
|
5163
|
POST
|
Actually this env.workspace = " " means i defined the workspace, not the empty workspace. Well the last two lines are really helpful, Thanks.
... View more
12-23-2014
06:32 AM
|
0
|
0
|
1958
|
Title | Kudos | Posted |
---|---|---|
1 | 12-27-2014 01:09 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|