POST
|
I am working on suggesting the potential sites for industries in a province.The process includes 18 layers. I am done with the MCDA results and maps. Now I want to design a web based application in which I can change the criteria (weights of different indicators) and can get the result as a map on web page. Is it possible using ArcGIS or any other way? Regards
... View more
01-19-2018
09:16 PM
|
0
|
2
|
671
|
POST
|
I am working on a project in which I have to classify high resolution images to extract the built-up areas of 50 cities and then to calculate the percentage of the area. Is there any algorithm existing in Arcpy which helps to classify the built-up area automatically? I mean if I give the raster image as input and the output should meet the requirement.
... View more
07-17-2017
04:02 AM
|
0
|
2
|
513
|
POST
|
I am creating graphs using arcpy and facing this error while I give the input layer from the mxd. In case, if I give the input from direct shapefile, then graphs are generated. Kindness is required in this issue. The code I have written is given by: import arcpy, os, sys
relpath = os.path.dirname(sys.argv[0])
arcpy.env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument(relpath + r"\map.mxd")
index_layer1 = arcpy.mapping.ListLayers(mxd, "Index_Layer")[0]
input_data = "E:\Python\Utility\map data\Index_Layer.shp"
required_graphs = ['NCI_2011_', 'N_SI_2011_', 'N_IDDI_201', 'N_IDDI_202', 'N_CI_2014_', 'N_SI_2014_', 'N_IDDI_203']
input_template = "E:\Python\Utility\graphs\sample.grf"
#Getting required graphs
for x in required_graphs:
print "Creating graph of " + x
# Create the graph
graph = arcpy.Graph()
# Add a horizontal bar series to the graph
graph.addSeriesBarHorizontal(index_layer1, x)
# Specify the title of the left axis
out_graph_bmp = "E:/Python\Utility/graphs/_{}".format(x) +".jpg"
graph.graphAxis[0].title = ""
# Specify the title of the bottom axis
graph.graphAxis[2].title = ""
# Specify the title of the Graph
graph.graphPropsGeneral.title = x
# Output a graph, which is created in-memory
arcpy.MakeGraph_management(input_template, graph, "graph_{}".format(x))
# Save the graph as an image
arcpy.SaveGraph_management("graph_{}".format(x), out_graph_bmp, "IGNORE_ASPECT_RATIO", 592, 1388)
... View more
07-10-2017
12:02 AM
|
0
|
0
|
619
|
POST
|
I am working on a mapbook and I require to label the features against different fields in different maps. How can I do this using arcpy? Regards
... View more
07-09-2017
07:08 AM
|
0
|
6
|
9036
|
POST
|
I am generating maps of a province which contain details about population growth of 36 cities temporally (2000, 2004, 2008, 2012, 2016). These values are stored in attribute table of the shapefile as fields like pop2000, pop2004 etc. I have to generate map for each i,e 2000, 2004, 2008, 2012, 2016. In each of the map, like if I am generating 2008 map, I want the values of field 2008 to be displayed in table. I already have done work with tables and graphs successfully. I just want to know: 1. From a single MXD, I want to generate all the maps in a single PDF as Final Output. 2. The map and layout for each of the maps will be same, just values of population growth will be changed, the required values should be got from the fields stored in attribute table of the shapefile. Regards
... View more
07-06-2017
09:45 AM
|
0
|
0
|
280
|
POST
|
Sir, I have updated the post, your kindness is required.
... View more
07-02-2017
10:43 AM
|
0
|
1
|
781
|
POST
|
Dear sir, hope you are fine. I require your little favor. Please don't mind, I'm fairly new to development. Can you please rectify my code. I just tell you the detail about. I am working on MapBook via DDP. I have to select points which are intersecting the boundary layer of current page and then want to display the table in maps. I am done with other work just facing problem with selection. I have a layer named "IndexLayer" which contains the boundaries of cities under the attribute "Division". There is another layer which contains points, that is named "tlsf". I want to select the points which are intersecting the opened page boundary but as per my script, all the points are selected and displayed in the table. I am posting python code here. I tried to write the code under suggested format but with very sorry I coudn't write in that way. Please don't mind. Is it possible if I can get your email address? The code is given by # import arcpy, os, sys relpath = os.path.dirname(sys.argv[0]) division = arcpy.GetParameterAsText(0) #Reference MXD and layers mxd = arcpy.mapping.MapDocument(relpath + r"\map.mxd") transferStation = arcpy.mapping.ListLayers(mxd, "tlsf")[0] #Reference page layout elements for elm in arcpy.mapping.ListLayoutElements(mxd): if elm.name == "bar1": bar1 = elm if elm.name == "bar2": bar2 = elm if elm.name == "bar3": bar3 = elm if elm.name == "bar1txt": bar1txt = elm if elm.name == "bar2txt": bar2txt = elm if elm.name == "bar3txt": bar3txt = elm if elm.name == "NoGrowth": noGrowth = elm if elm.name == "horzLine": horzLine = elm if elm.name == "vertLine": vertLine = elm if elm.name == "cellTxt": cellTxt = elm if elm.name == "headerTxt": headerTxt = elm #Clean-up before next page for elm in arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "*clone*"): elm.delete() for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "*clone*"): elm.delete() noGrowth.elementPositionX = -3 cellTxt.elementPositionX = -3 headerTxt.elementPositionX = -3 horzLine.elementPositionX = -3 vertLine.elementPositionX = -3 #Reference DDP object and set appropriate page ddp = mxd.dataDrivenPages ddp.currentPageID = ddp.getPageIDFromName(division) #Graphic table variable values tableHeight = 3.0 tableWidth = 4.5 headerHeight = 0.2 rowHeight = 0.15 upperX = 11 upperY = 3.2 #Build selection set divisionName = ddp.pageRow.Division arcpy.AddMessage("Processing: " + division) with arcpy.da.SearchCursor("IndexLayer", ("Division")) as cursor: for row in cursor: exp = 'Division = divisionName'.format(row[0]) arcpy.SelectLayerByAttribute_management("IndexLayer", "NEW_SELECTION", exp) # selection arcpy.SelectLayerByLocation_management("transferStation", "INTERSECT", "NEW_SELECTION", "IndexLayer4") arcpy.Select_analysis(transferStation, "in_memory\IndexLayer4", '') numRecords = int(arcpy.GetCount_management("in_memory\IndexLayer4").getOutput(0)) #Sort selection #Show selected features #Add note if there are no counties > 100% if numRecords == 0: noGrowth.elementPositionX = 3 noGrowth.elementPositionY = 2 else: #if number of rows exceeds page space, resize row height if ((tableHeight - headerHeight) / numRecords) < rowHeight: headerHeight = headerHeight * ((tableHeight - headerHeight) / numRecords) / rowHeight rowHeight = (tableHeight - headerHeight) / numRecords #Set and clone vertical line work vertLine.elementHeight = (headerHeight) + (rowHeight * numRecords) vertLine.elementPositionX = upperX vertLine.elementPositionY = upperY temp_vert = vertLine.clone("_clone") temp_vert.elementPositionX = upperX + 1.5 temp_vert = vertLine.clone("_clone") temp_vert.elementPositionX = upperX + 2.5 temp_vert = vertLine.clone("_clone") temp_vert.elementPositionX = upperX + 3.5 temp_vert = vertLine.clone("_clone") temp_vert.elementPositionX = upperX + 4.5 #Set and clone horizontal line work horzLine.elementWidth = tableWidth horzLine.elementPositionX = upperX horzLine.elementPositionY = upperY horzLine.clone("_clone") horzLine.elementPositionY = upperY - headerHeight print numRecords y=upperY - headerHeight for horz in range(1, numRecords+1): y = y - rowHeight temp_horz = horzLine.clone("_clone") temp_horz.elementPositionY = y #Set header text elements headerTxt.fontSize = headerHeight / 0.0155 headerTxt.text = "Name" headerTxt.elementPositionX = upperX + 0.75 headerTxt.elementPositionY = upperY - (headerHeight / 2) newFieldTxt = headerTxt.clone("_clone") newFieldTxt.text = "Type" newFieldTxt.elementPositionX = upperX + 2 newFieldTxt = headerTxt.clone("_clone") newFieldTxt.text = "Longitude" newFieldTxt.elementPositionX = upperX + 2.75 newFieldTxt = headerTxt.clone("_clone") newFieldTxt.text = "Latitude" newFieldTxt.elementPositionX = upperX + 3.25 #Set and clone cell text elements cellTxt.fontSize = rowHeight / 0.0155 y = upperY - headerHeight rows = arcpy.SearchCursor("in_memory\IndexLayer4") for row in rows: x = upperX + 0.05 col1CellTxt = cellTxt.clone("_clone") col1CellTxt.text = row.getValue("Name") col1CellTxt.elementPositionX = x col1CellTxt.elementPositionY = y col2CellTxt = cellTxt.clone("_clone") col2CellTxt.text = row.getValue("Type") col2CellTxt.elementPositionX = x + 1.75 col2CellTxt.elementPositionY = y col3CellTxt = cellTxt.clone("_clone") col3CellTxt.text = str(round(row.getValue("Longitude"), 2)) col3CellTxt.elementPositionX = x + 3 col3CellTxt.elementPositionY = y col4CellTxt = cellTxt.clone("_clone") col4CellTxt.text = str(round(row.getValue("Longitude"), 2)) col4CellTxt.elementPositionX = x +4.75 col4CellTxt.elementPositionY = y y = y - rowHeight arcpy.Delete_management("in_memory\IndexLayer4") arcpy.Delete_management("in_memory\IndexLayer4") arcpy.mapping.ExportToPDF(mxd, relpath + "\\" + division + ".pdf") os.startfile(relpath + "\\" + division + ".pdf")
... View more
06-30-2017
03:37 PM
|
0
|
3
|
781
|
POST
|
0-Dear sir, I am hopeful that you will be fine. Please look at the problem I am pointing at: I am working on mapbook and data driven is applied on a layer named "IndexLayer" against "Divsion" field. This layer contains the boundaries of Divisions (Division is an administrative distribution, which contains more than one city in my country). I have some point which are placed in a layer named, "tlsf". At the data driven pages, on the each division page, I want to select the point which lie into the corresponding boundary and then want them to display on the map. I have worked on the table. The problem I am getting is a the selection end. The received error is attached in the screen shot. I am also pasting the code here. I require your kindness. Thanks import arcpy, os, sys relpath = os.path.dirname(sys.argv[0]) division = arcpy.GetParameterAsText(0) #Reference MXD and layers mxd = arcpy.mapping.MapDocument(relpath + r"\map.mxd") transferStation = arcpy.mapping.ListLayers(mxd, "tlsf")[0] #Reference page layout elements for elm in arcpy.mapping.ListLayoutElements(mxd): if elm.name == "bar1": bar1 = elm if elm.name == "bar2": bar2 = elm if elm.name == "bar3": bar3 = elm if elm.name == "bar1txt": bar1txt = elm if elm.name == "bar2txt": bar2txt = elm if elm.name == "bar3txt": bar3txt = elm if elm.name == "NoGrowth": noGrowth = elm if elm.name == "horzLine": horzLine = elm if elm.name == "vertLine": vertLine = elm if elm.name == "cellTxt": cellTxt = elm if elm.name == "headerTxt": headerTxt = elm #Clean-up before next page for elm in arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "*clone*"): elm.delete() for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "*clone*"): elm.delete() noGrowth.elementPositionX = -3 cellTxt.elementPositionX = -3 headerTxt.elementPositionX = -3 horzLine.elementPositionX = -3 vertLine.elementPositionX = -3 #Reference DDP object and set appropriate page ddp = mxd.dataDrivenPages ddp.currentPageID = ddp.getPageIDFromName(division) #Graphic table variable values tableHeight = 3.0 tableWidth = 2.5 headerHeight = 0.2 rowHeight = 0.15 upperX = 2.8 upperY = 3.2 #Build selection set divisionName = ddp.pageRow.Division arcpy.AddMessage("Processing: " + division) with arcpy.da.SearchCursor("IndexLayer", ("Division")) as cursor: for row in cursor: exp = 'Division = division'.format(row[0]) arcpy.SelectLayerByAttribute_management("IndexLayer", "NEW_SELECTION", exp) # selection arcpy.SelectLayerByLocation_management("transferStation", "WITHIN", "NEW_SELECTION", "IndexLayer") arcpy.Select_analysis(transferStation, "in_memory\select1", '') numRecords = int(arcpy.GetCount_management("in_memory\select1").getOutput(0)) #Sort selection #Show selected features #Add note if there are no counties > 100% if numRecords == 0: noGrowth.elementPositionX = 3 noGrowth.elementPositionY = 2 else: #if number of rows exceeds page space, resize row height if ((tableHeight - headerHeight) / numRecords) < rowHeight: headerHeight = headerHeight * ((tableHeight - headerHeight) / numRecords) / rowHeight rowHeight = (tableHeight - headerHeight) / numRecords #Set and clone vertical line work vertLine.elementHeight = (headerHeight) + (rowHeight * numRecords) vertLine.elementPositionX = upperX vertLine.elementPositionY = upperY temp_vert = vertLine.clone("_clone") temp_vert.elementPositionX = upperX + 1.5 temp_vert = vertLine.clone("_clone") temp_vert.elementPositionX = upperX + 2.5 #Set and clone horizontal line work horzLine.elementWidth = tableWidth horzLine.elementPositionX = upperX horzLine.elementPositionY = upperY horzLine.clone("_clone") horzLine.elementPositionY = upperY - headerHeight print numRecords y=upperY - headerHeight for horz in range(1, numRecords+1): y = y - rowHeight temp_horz = horzLine.clone("_clone") temp_horz.elementPositionY = y #Set header text elements headerTxt.fontSize = headerHeight / 0.0155 headerTxt.text = "Name" headerTxt.elementPositionX = upperX + 0.75 headerTxt.elementPositionY = upperY - (headerHeight / 2) newFieldTxt = headerTxt.clone("_clone") newFieldTxt.text = "Type" newFieldTxt.elementPositionX = upperX + 2 newFieldTxt = headerTxt.clone("_clone") newFieldTxt.text = "Longitude" newFieldTxt.elementPositionX = upperX + 2 newFieldTxt = headerTxt.clone("_clone") newFieldTxt.text = "Latitude" newFieldTxt.elementPositionX = upperX + 2 #Set and clone cell text elements cellTxt.fontSize = rowHeight / 0.0155 y = upperY - headerHeight rows = arcpy.SearchCursor("in_memory\select1") for row in rows: x = upperX + 0.05 col1CellTxt = cellTxt.clone("_clone") col1CellTxt.text = row.getValue("Name") col1CellTxt.elementPositionX = x col1CellTxt.elementPositionY = y col2CellTxt = cellTxt.clone("_clone") col2CellTxt.text = row.getValue("Type") col2CellTxt.elementPositionX = x + 1.75 col2CellTxt.elementPositionY = y col3CellTxt.text = str(round(row.getValue("Longitude"), 2)) col3CellTxt.elementPositionX = x + 3 col3CellTxt.elementPositionY = y col4CellTxt.text = str(round(row.getValue("Longitude"), 2)) col4CellTxt.elementPositionX = x +4.75 col4CellTxt.elementPositionY = y y = y - rowHeight arcpy.mapping.ExportToPDF(mxd, relpath + "\\" + division + ".pdf") os.startfile(relpath + "\\" + division + ".pdf")
... View more
06-24-2017
05:33 AM
|
0
|
5
|
781
|
POST
|
Thank you sir for your kindness, I found it really helpful.
... View more
06-24-2017
12:29 AM
|
0
|
0
|
781
|
POST
|
Dear sir, Xander Bakker Dan_Patterson hope you are fine. I require your little favor. Please don't mind, I'm fairly new to development. Can you please rectify my code. I just tell you the detail about. I am working on MapBook via DDP. I have to select points which are within the boundary layer of current page and then want to display the table in maps. I am done with other work just facing problem with selection. I have a layer named "IndexLayer" which contains the boundaries of cities under the attribute "Division". There is another layer which contains points, that is named "tlsf". I want to select the points which are within the opened page boundary but as per my script, all the points are selected and displayed in the table. I am posting python code here. Please don't mind. Is it possible if I can get your email address? The code is given by: import arcpy, os, sys
relpath = os.path.dirname(sys.argv[0])
division = arcpy.GetParameterAsText(0)
#Reference MXD and layers
mxd = arcpy.mapping.MapDocument(relpath + r"\map.mxd")
transferStation = arcpy.mapping.ListLayers(mxd, "tlsf")[0]
#Reference page layout elements
for elm in arcpy.mapping.ListLayoutElements(mxd):
if elm.name == "bar1": bar1 = elm
if elm.name == "bar2": bar2 = elm
if elm.name == "bar3": bar3 = elm
if elm.name == "bar1txt": bar1txt = elm
if elm.name == "bar2txt": bar2txt = elm
if elm.name == "bar3txt": bar3txt = elm
if elm.name == "NoGrowth": noGrowth = elm
if elm.name == "horzLine": horzLine = elm
if elm.name == "vertLine": vertLine = elm
if elm.name == "cellTxt": cellTxt = elm
if elm.name == "headerTxt": headerTxt = elm
#Clean-up before next page
for elm in arcpy.mapping.ListLayoutElements(mxd, "GRAPHIC_ELEMENT", "*clone*"):
elm.delete()
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", "*clone*"):
elm.delete()
noGrowth.elementPositionX = -3
cellTxt.elementPositionX = -3
headerTxt.elementPositionX = -3
horzLine.elementPositionX = -3
vertLine.elementPositionX = -3
#Reference DDP object and set appropriate page
ddp = mxd.dataDrivenPages
ddp.currentPageID = ddp.getPageIDFromName(division)
#Graphic table variable values
tableHeight = 3.0
tableWidth = 4.5
headerHeight = 0.2
rowHeight = 0.15
upperX = 11
upperY = 3.2
#Build selection set
divisionName = ddp.pageRow.Division
arcpy.AddMessage("Processing: " + division)
with arcpy.da.SearchCursor("IndexLayer", ("Division")) as cursor:
for row in cursor:
exp = 'Division = divisionName'.format(row[0])
arcpy.SelectLayerByAttribute_management("IndexLayer", "NEW_SELECTION", exp)
# selection
arcpy.SelectLayerByLocation_management("transferStation", "INTERSECT", "NEW_SELECTION", "IndexLayer4")
arcpy.Select_analysis(transferStation, "in_memory\IndexLayer4", '')
numRecords = int(arcpy.GetCount_management("in_memory\IndexLayer4").getOutput(0))
#Sort selection
#Show selected features
#Add note if there are no counties > 100%
if numRecords == 0:
noGrowth.elementPositionX = 3
noGrowth.elementPositionY = 2
else:
#if number of rows exceeds page space, resize row height
if ((tableHeight - headerHeight) / numRecords) < rowHeight:
headerHeight = headerHeight * ((tableHeight - headerHeight) / numRecords) / rowHeight
rowHeight = (tableHeight - headerHeight) / numRecords
#Set and clone vertical line work
vertLine.elementHeight = (headerHeight) + (rowHeight * numRecords)
vertLine.elementPositionX = upperX
vertLine.elementPositionY = upperY
temp_vert = vertLine.clone("_clone")
temp_vert.elementPositionX = upperX + 1.5
temp_vert = vertLine.clone("_clone")
temp_vert.elementPositionX = upperX + 2.5
temp_vert = vertLine.clone("_clone")
temp_vert.elementPositionX = upperX + 3.5
temp_vert = vertLine.clone("_clone")
temp_vert.elementPositionX = upperX + 4.5
#Set and clone horizontal line work
horzLine.elementWidth = tableWidth
horzLine.elementPositionX = upperX
horzLine.elementPositionY = upperY
horzLine.clone("_clone")
horzLine.elementPositionY = upperY - headerHeight
print numRecords
y=upperY - headerHeight
for horz in range(1, numRecords+1):
y = y - rowHeight
temp_horz = horzLine.clone("_clone")
temp_horz.elementPositionY = y
#Set header text elements
headerTxt.fontSize = headerHeight / 0.0155
headerTxt.text = "Name"
headerTxt.elementPositionX = upperX + 0.75
headerTxt.elementPositionY = upperY - (headerHeight / 2)
newFieldTxt = headerTxt.clone("_clone")
newFieldTxt.text = "Type"
newFieldTxt.elementPositionX = upperX + 2
newFieldTxt = headerTxt.clone("_clone")
newFieldTxt.text = "Longitude"
newFieldTxt.elementPositionX = upperX + 2.75
newFieldTxt = headerTxt.clone("_clone")
newFieldTxt.text = "Latitude"
newFieldTxt.elementPositionX = upperX + 3.25
#Set and clone cell text elements
cellTxt.fontSize = rowHeight / 0.0155
y = upperY - headerHeight
rows = arcpy.SearchCursor("in_memory\IndexLayer4")
for row in rows:
x = upperX + 0.05
col1CellTxt = cellTxt.clone("_clone")
col1CellTxt.text = row.getValue("Name")
col1CellTxt.elementPositionX = x
col1CellTxt.elementPositionY = y
col2CellTxt = cellTxt.clone("_clone")
col2CellTxt.text = row.getValue("Type")
col2CellTxt.elementPositionX = x + 1.75
col2CellTxt.elementPositionY = y
col3CellTxt = cellTxt.clone("_clone")
col3CellTxt.text = str(round(row.getValue("Longitude"), 2))
col3CellTxt.elementPositionX = x + 3
col3CellTxt.elementPositionY = y
col4CellTxt = cellTxt.clone("_clone")
col4CellTxt.text = str(round(row.getValue("Longitude"), 2))
col4CellTxt.elementPositionX = x +4.75
col4CellTxt.elementPositionY = y
y = y - rowHeight
arcpy.Delete_management("in_memory\IndexLayer4")
arcpy.Delete_management("in_memory\IndexLayer4")
arcpy.mapping.ExportToPDF(mxd, relpath + "\\" + division + ".pdf")
os.startfile(relpath + "\\" + division + ".pdf")
... View more
06-22-2017
12:05 PM
|
0
|
9
|
1404
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|