|
POST
|
import arcpy
import pythonaddins
import functools
import os
import threading
import webbrowser
arcpy.env.overwriteOutput = True
def run_in_other_thread(function):
@functools.wraps(function)
def fn_(*args, **kwargs):
thread = threading.Thread(target=function, args=args, kwargs=kwargs)
thread.start()
thread.join()
return fn_
openbrowser = run_in_other_thread(webbrowser.open)
class GoogleExtension(object):
"""Implementation for GoogleTool_addin.extension10 (Extension)"""
def activeViewChanged(self):
mxd = arcpy.mapping.MapDocument('current')
active_view = mxd.activeView
# tool1 is the tool ID (without the namespace prefix)
if active_view == 'PAGE_LAYOUT':
tool.enabled = False
else:
tool.enabled = True
arcpy.RefreshActiveView()
return
class MapChannels(object):
"""Implementation for GoogleTool_gmcaddin.tool (Tool)"""
def __init__(self):
self.enabled = True
self.shape = "NONE"
def onMouseUpMap(self, x, y, button, shift):
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
dfsr = df.spatialReference
if len(dfsr.type) > 0:
pass
else:
msgbox = pythonaddins.MessageBox('No Coordinate System','Oops!',0)
print msgbox
sys.exit("Unknown projection")
in_memory = "in_memory"
fcname = "pnt_name4444aj"
#x,y = [2424419.971, 864749.537]
fc = arcpy.CreateFeatureclass_management(in_memory,fcname,"POINT","","DISABLED","DISABLED",dfsr)
rows = arcpy.da.InsertCursor(fc,["SHAPE@XY"])
xy = (x,y)
rows.insertRow([xy])
del rows
sr = 'GEOGCS["GCS_North_American_1927",DATUM["D_North_American_1927",SPHEROID["Clarke_1866",6378206.4,294.9786982]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'
for row in arcpy.da.SearchCursor(fc, ["SHAPE@XY"],"",sr):
adx,ady = row[0]
#print("{0}, {1}".format(adx, ady))
for lyr in arcpy.mapping.ListLayers(mxd, "", df):
if lyr.name == fcname:
arcpy.mapping.RemoveLayer(df, lyr)
url = "http://data.mapchannels.com/mm/dual2/map.htm?x=" + str(adx) + "&y="+ str(ady) + "&z=16&xb=" + str(adx) + "&yb="+ str(ady) + "&bar=1&mw=1&gm=0&ve=2&sv=1"#&svb="+ String(computeAngle2(startPt,lastPnt))
openbrowser(url)
del mxd,df,dfsr,in_memory,fc,xy,sr,row,url
... View more
08-18-2015
07:00 AM
|
0
|
0
|
1329
|
|
POST
|
Are your features points? Do you have an Advanced License? You could use Aggregate Points to predetermine density. http://resources.arcgis.com/en/help/main/10.1/index.html#//00700000002s000000
... View more
08-18-2015
06:01 AM
|
1
|
0
|
3388
|
|
POST
|
See this article and see if this points you in the right direction Creating relationship class in ArcMap 10.2 | mapsnigeriainitiative
... View more
08-18-2015
05:50 AM
|
0
|
13
|
4805
|
|
POST
|
I haven't tested with either tool Jayanta Poddar recommends but most tools in arctoolbox honor a selection set. Sounds like you could run these tools and get the desired result. I would make a copy of the data before I tried.
... View more
08-18-2015
05:44 AM
|
1
|
0
|
1742
|
|
POST
|
Do you have a layer named "Layer to be reported on" in the other mxd's? edit: The name must be the same. You are also using report writer are the fields the same in the other layers you want to report on. You can change the field assignments, but it takes extra steps
... View more
08-17-2015
08:16 AM
|
0
|
1
|
1039
|
|
POST
|
In the "Page and Print Setup" uncheck "Use Printer Paper Settings" then set your desired width and height below the check box. This is the size that will be exported
... View more
08-17-2015
07:34 AM
|
1
|
0
|
713
|
|
POST
|
When doing SQL expressions for python code i usually start by creating the query in select by attribute and then copy it to the code this usually ensures i have the correct syntax
... View more
08-15-2015
04:07 PM
|
1
|
0
|
2428
|
|
POST
|
Are all the mxds going to be data driven pages? Here is the data driven pages examples http://resources.arcgis.com/en/help/main/10.2/index.html#//00s300000030000000
... View more
08-13-2015
12:53 PM
|
0
|
3
|
3214
|
|
POST
|
For anyone who might be interested in the future the code is not elegant, but it is functional. I also converted a scale bar to a graphic and I'm updating the text elements on that scale bar. def returnScale(dfscale):
scalebar = [2,3,4,5,6,10]
dfscale = dfscale/12
dfscale = str(int(dfscale))
dfscaleLen = len(dfscale)
numcheck = int(dfscale[0])
for each in scalebar:
if numcheck < each:
multi = '1'
while dfscaleLen > 1:
multi = multi + '0'
dfscaleLen = dfscaleLen - 1
scalebar = each * int(multi)
dataframescale = scalebar * 12
return scalebar,dataframescale
break
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
scalebar,dataframescale = returnScale(df.scale)
scalebarDict = {"scaletextElm1":scalebar,"scaletextElm2":scalebar/2}
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT"):
if elm.name in scalebarDict:
elm.text = scalebarDict[elm.name]
df.scale = dataframescale
arcpy.RefreshActiveView()
... View more
08-13-2015
12:11 PM
|
0
|
0
|
1372
|
|
POST
|
Do you have a field that has address already in, just not rounded to the block number? If you do you could use a label expression like below. def FindLabel ( [FROMLEFT] ):
a = float([FROMLEFT] )
return int(round(a,-2))
... View more
08-12-2015
10:59 AM
|
0
|
1
|
1070
|
|
POST
|
Jason the script creates 3 files for every year that has features with red. If I remember correctly Y00 and Y01 didn't have any red features to use. I think if you check just those years that begin with clip they may be what you are describing. If that is the case you just need to generate a list and feed it into the merge tool ArcGIS Help (10.2, 10.2.1, and 10.2.2)
... View more
08-12-2015
07:38 AM
|
0
|
0
|
2779
|
|
POST
|
Is your table inside your dataset with the same name? You need to provide the full path "database\dataset\table"
... View more
08-11-2015
05:43 AM
|
0
|
7
|
3684
|
|
POST
|
I put this code together to get and set the map to a known scale. I was wanting to know has anyone else done something like this? Below is the code. def returnScale(dfscale):
scalebar = [2,3,4,5,6,10]
dfscale = dfscale/12
dfscale = str(int(dfscale))
dfscaleLen = len(dfscale)
numcheck = int(dfscale[0])
for each in scalebar:
if numcheck < each:
multi = '1'
while dfscaleLen > 1:
multi = multi + '0'
dfscaleLen = dfscaleLen - 1
scalebar = each * int(multi)
dataframescale = scalebar * 12
return scalebar,dataframescale
break
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd)[0]
df.scale = returnScale(df.scale)[1]
arcpy.RefreshActiveView()
... View more
08-10-2015
12:05 PM
|
0
|
1
|
3966
|
|
POST
|
I'm not sure there is a limit of number of dataframes. I would suppose it would be left up to the user to decide how many would be useful. ArcGIS Help 10.1
... View more
08-06-2015
10:43 AM
|
1
|
5
|
1863
|
| Title | Kudos | Posted |
|---|---|---|
| 2 | 09-14-2015 01:29 PM | |
| 1 | 01-26-2016 10:18 AM | |
| 1 | 08-18-2015 06:01 AM | |
| 1 | 06-20-2016 12:34 PM | |
| 1 | 01-19-2016 06:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|