POST
|
Is there a way I can create a flow map in ArcGis which shows movement from different point to one example if its an airport a flow map which shows all the traffic for Airport A from Airport B, Airport C, Airport D etc .. Thank you in advance.
... View more
01-30-2018
05:48 AM
|
0
|
1
|
2078
|
POST
|
Thanks let me put in my codes and i will tell you the output
... View more
12-28-2017
06:16 AM
|
0
|
0
|
3865
|
POST
|
which variable do i change to int or float is it the valuelist or the value? and I am confused on how to do that
... View more
12-28-2017
03:07 AM
|
0
|
3
|
3865
|
POST
|
I want to allow the user to choose several value from a list of values then later i want to use these values to iterate through a raster data set. But very time i keep getting errors saying the data set is not correct. My code is here:
import arcpy,os
inputraster = arcpy.GetParameterAsText(0)
sea_level = arcpy.GetParameterAsText(1)
fc = arcpy.GetParameterAsText(2)
clipraster = arcpy.GetParameterAsText
valuelist = [x.strip() for x in sea_level.split(";")]
for value in valuelist:
arcpy.Clip_management(inputraster,"#",clipraster,fc,"#","ClippingGeometry","MAINTAIN_EXTENT")
clip_raster = arcpy.Raster(clipraster)
floodedarea = os.path.join(outputfolder + "floods" + str(value))
areasbelow = clip_raster <= value
areasbelow.save(floodedarea)
arcpy.AddMessage(areasbelow)
... View more
12-27-2017
11:09 AM
|
0
|
7
|
5452
|
POST
|
But i dont have the hard coded values every data is from the user
... View more
12-17-2017
12:07 PM
|
0
|
1
|
1524
|
POST
|
I have sea level rise scenarios, so if a cell is below the sea level it is flooded so i want to check if the other neighboring are connected to the flooded cell.
... View more
12-17-2017
12:05 PM
|
0
|
0
|
1524
|
POST
|
Hello, can anybody help with a python script that checks if cell A is connected to its neighboring cells and if it flooded then the cell connecting cells should be flooded too. I tried the code below but i cant seem to figure out how to in-cooperate my data into the script. My data include a DEM from which i will check inundated zone:
import heapq
import numpy as np
from scipy import ndimage
def flood_fill(test_array, four_way=False):
""""""
input_array = np.copy(test_array)
input_rows, input_cols = input_array.shape
# Set h_max to a value larger than the array maximum to ensure
# that the while loop will terminate
h_max = np.max(input_array*2.0)
# Build mask of cells with data not on the edge of the image
# Use 3x3 square structuring element
inside_mask = ndimage.binary_erosion(
np.isfinite(input_array),
structure=ndimage.generate_binary_structure(2, 2).astype(np.int))
# Initialize output array as max value test_array except edges
output_array = np.copy(input_array)
output_array[inside_mask] = h_max
# Build priority queue and place edge pixels into priority queue
# Last value is flag to indicate if cell is an edge cell
put = heapq.heappush
get = heapq.heappop
fill_heap = [
(output_array[t_row, t_col], int(t_row), int(t_col), True)
for t_row, t_col in np.transpose(np.where(edge_mask))]
heapq.heapify(fill_heap)
def neighbors(row, col, four_way=False):
"""Return indices of adjacent cells"""
if four_way:
return [
(row - 1, col), (row, col + 1),
(row + 1, col), (row, col - 1)]
else:
return [
(row - 1, col), (row - 1, col + 1),
(row, col + 1), (row + 1, col + 1),
(row + 1, col), (row + 1, col - 1),
(row, col - 1), (row - 1, col - 1)]
# Iterate until priority queue is empty
while True:
try:
h_crt, t_row, t_col, edge_flag = get(fill_heap)
except IndexError:
break
for n_row, n_col in neighbors(t_row, t_col, four_way):
# Skip cell if outside array edges
if edge_flag:
try:
if not inside_mask[n_row, n_col]:
continue
except IndexError:
... View more
12-14-2017
01:04 PM
|
0
|
6
|
1898
|
POST
|
I am running the code in a custom toolbox and therefore the use of the arcpy.AddMessage
... View more
12-12-2017
10:28 AM
|
0
|
2
|
1038
|
POST
|
I have written a code to check if areas will be inundates when a certain value is added, the code doesn't give any errors but at the same time it does do anything. Just says running code complete, I am not even sure what the problem is. My code is here import arcpy
import os, sys, traceback, shutil
import numpy as np
arcpy.env.overwriteOutput = True
try:
outputfolder = arcpy.GetParameterAsText(0)
fc = arcpy.GetParameterAsText(1)
inputraster = arcpy.GetParameterAsText(2)
#check to see if the arcinfo license is on
if arcpy.CheckExtension("Spatial") == "Available":
arcpy.CheckOutExtension("Spatial")
else:
arcpy.AddError("Spatial analyst extension is not licensed.")
sys.exit()
#set the Progressor
#arcpy.SetProgessor("step","Checking input requirements....",0,9,1)
#Process :create an out put folder
arcpy.CreateFileGDB_management(outputfolder,"output.gdb")
outputgdb = outputfolder + "\\output.gdb"+ os.step
#create path to store raster data
clippedraster = outputfolder + "clippedraster"
flooded = outputfolder +"floodedarea"
#check to see if the inputs are in the same projection
desccs_ras = arcpy.Describe(inputraster).SpatialReference
desccs_fc = arcpy.Describe(fc).SpatialReference
if desccs_ras.name == "Unknown" and desccs_fc.name == "Unknown":
arcpy.AddMessage("Your data does not have a defined spatial reference")
else:
if desccs_ras.projectionName == desccs_fc.projectionName:
""
else:
arcpy.AddError("The input Data should be in the same projection")
sys.exit()
del desccs_fc,desccs_ras
#remove the areas below sea level
currentRaster = arcpy.Raster(inputraster)
rastertoclip = Con(currentRaster>=0,currentRaster,1)
#clip the raster data to the interested zone extend
arcpy.Clip_management(rastertoclip,"#",clippedraster,fc,"#","ClippingGeometry","MAINTAIN_EXTENT")
clip_raster = arcpy.Raster("in_memory")
areasbelow = clip_raster <= 2
areasbelow.save(flooded)
md = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(md)[0]
result = arcpy.MakeRasterLayer_management(flooded,"FloodedArea")
layer = result.getOutput(0)
arcpy.mapping.AddLayer(df, layer,"AUTO_ARRANGE")
except:
tb = sys.exc_info()[2]
tbinfo = traceback.format_tb(tb)[0]
pymsg = "PYTHON ERRORS:\nTraceback Info:\n" + tbinfo + "\nError Info:\n " + \
str(sys.exc_type)+ ": " + str(sys.exc_value) + "\n"
... View more
12-12-2017
05:45 AM
|
0
|
5
|
1166
|
POST
|
I just researched and got that you can find the flooded areas by using the values in the raster data but if there is any other way to get the flooded areas I am eagerly listening, because I have data in polygon files and raster data and I am trying to calculate the flooded areas in the raster. So if you have any other that would be great.
... View more
11-24-2017
07:27 AM
|
0
|
1
|
662
|
POST
|
I am still facing the same problem even after copying the raster, the raster properties and value ranges are as follows:
... View more
11-24-2017
06:51 AM
|
0
|
4
|
2844
|
POST
|
I checked the results and found it to be a 32 bit, ii think that's why it cant produce an attribute value.
... View more
11-24-2017
05:34 AM
|
0
|
6
|
2844
|
POST
|
I need to use these values to calculate flooded areas that's the reason i need the raster values.
... View more
11-24-2017
05:29 AM
|
0
|
0
|
2844
|
POST
|
with the Int tool still am not getting the attribute table and when i truncate with 10 all the values become one. I would be glad if you could provide the python/numpy solution
... View more
11-24-2017
12:50 AM
|
0
|
10
|
2844
|
POST
|
Hello everyone. is there a way to convert a polygon shape file into raster if it has values of precise decimal type. I used the polygon to raster tool and the produced raster does not have an attribute table and i cannot use the Build Raster attribute tool to build the table .
... View more
11-23-2017
02:18 PM
|
0
|
12
|
4700
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|