|
POST
|
There are probably several ways to convert the PDF to a vector format readable in ArcGIS, but the PDF will probably not have any coordinates, so this procedure is not recommended. What type of data is contained in the PDF?
... View more
11-26-2014
10:20 AM
|
0
|
3
|
2646
|
|
POST
|
You may want to have a look if the gdb contains any domains, representations, subtypes, relationship classes, etc. Always be cautious when copying data that you don’t create any duplicate data.
... View more
11-26-2014
10:14 AM
|
0
|
0
|
1905
|
|
POST
|
Hi Kevin, Just to make things clear for me, you want to create maps based on your layer us_cities.shp, in which you visualize each column. You probably have a column “DummyColumn” which is used to symbolize the featureclass. You want to overwrite the content in that column so that the symbology changes and adapts to the current column in the loop. Is this right? You could try this: import arcpy
arcpy.env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument(r"\\bsedom5\users\kachieng2\Desktop\Achieng\Python\Lesson1\Lesson1\ModelPractice.mxd")
DataFrame = arcpy.mapping.ListDataFrames(mxd)[0]
polygonLayer = arcpy.mapping.ListLayers(mxd, "us_cities.shp", DataFrame)[0]
fldnames = [fld.name for fld in arcpy.ListFields(polygonLayer)]
# Columns = arcpy.ListFields(polygonLayer)
for fldname in fldnames:
# CalculateField_management (in_table, field, expression, {expression_type}, {code_block})
fldpy = "!{0}!".format(fldname)
arcpy.CalculateField_management(polygonLayer, "DummyColumn", fldpy, "PYTHON_9.3")
arcpy.mapping.ExportToPNG(mxd, r"\\bsedom5\users\kachieng2\Desktop\Achieng\Python\Lesson1\Lesson1\maps_"+ fldname + ".png") In this case on line 9 a list of fieldnames is created (you may notice it takes the name property of the fld object). The Field Calculator requires a certain format for specifying the field name. Using Python is will be !fieldname!. That is what is created on line 13 and used on line 14. The fieldname is used for naming the output png. Please be aware that this code still loops through all fields (including, text, shape, etc) which will create problems. A simple way would be to test for the field type to see if it can be used. Kind regards, Xander
... View more
11-26-2014
10:04 AM
|
0
|
0
|
1485
|
|
POST
|
Hi Michael, I haven't looked at the entire function, but I did notice 2 things: The statement get_dtype = .... has an additional ")" just before the end. Remove this and the string is ok However, you can't supply the string to the np.dtype function, but you can use an eval statement to solve this (this way the string is converted to the required list) get_dtype="[('YEAR', '<f8'), ('REGIONID', '<f8'), ('DISTRICTID', '<f8'), ('REGIONNAME', '|S255'), ('DISTRICTNAME', '|S255'), ('DIVLOC', '|S255'), ('STORENAME', '|S255'), ('CLUSTER', '|S255'), ('SUBID', '|S255'), ('SUBNAME', '|S255'), ('SEQUENCE', '<f8'), ('S_AREA', '<f8'), ('FS_AREA', '<f8'), ('ST_AREA', '<f8'), ('FR_AREA', '<f8'), ('SO_AREA', '<f8'), ('SL_AREA', '<f8'), ('TOTALSALES', '<f8'), ('OWNEDSALES', '<f8'), ('LEASEDSALES', '<f8'), ('GM', '<f8'), ('PROD', '<f8'), ('GMPROD', '<f8'), ('LATITUDE', '<f8'), ('LONGITUDE', '<f8'), ('RANKSALESSUB', '<f8'), ('RANKPRODSUB', '<f8'), ('RANKSALESSUBD', '<f8'), ('RANKPRODSUBD', '<f8'), ('RANKSALESSUBR', '<f8'), ('RANKPRODSUBR', '<f8'), ('RANKSALESSUBS', '<f8'), ('RANKPRODSUBS', '<f8'), ('RANKSALESSUBC', '<f8'), ('RANKPRODSUBC', '<f8')]"
dtype = np.dtype(eval(get_dtype)) Kind regards, Xander
... View more
11-26-2014
09:43 AM
|
0
|
1
|
2037
|
|
POST
|
What would be the string that holds the dtypes? Maybe these links are helpful: Using Numpy to Write a Dictionary to a Table Data type objects (dtype) — NumPy v1.9 Manual The other thing is, that it might not be a good idea to use fetchall. See this post: Arcpy - execute sql query in oracle error It is a bit difficult to see what is going on, when you post a small part of the code. Kind regards, Xander
... View more
11-26-2014
05:00 AM
|
0
|
3
|
2037
|
|
POST
|
Not sure what you are trying to achieve with the code, but I see several errors. Let's insert the code with syntax highlighting to make things more clear: import arcpy
arcpy.env.overwriteOutput = True
mxd = arcpy.mapping.MapDocument(r"\\bsedom5\users\kachieng2\Desktop\Achieng\Python\Lesson1\Lesson1\ModelPractice.mxd")
DataFrame = arcpy.mapping.ListDataFrames(mxd)[0]
polygonLayer = arcpy.mapping.ListLayers(mxd, "us_cities.shp", DataFrame)[0]
Columns = arcpy.ListFields(polygonLayer)
for col in Columns:
# CalculateField_management (in_table, field, expression, {expression_type}, {code_block})
arcpy.CalculateField_management(polygonLayer , "DummyColumn", col, "PYTHON_9.3")
arcpy.mapping.ExportToPNG(mxd, r"\\bsedom5\users\kachieng2\Desktop\Achieng\Python\Lesson1\Lesson1\maps"+ c + ".png") When you loop through the fields, you obtain Field objects (not field names) For each field will loop over fields like he Shape field, OID, etc With the field calculator for each field you assign the field object to the output field "DummyColumn" (I don't think this is what you want) On line 12 you have a variable c that does not exist. This might be "col", but since that is an object, you probably mean col.name... Can you explain what you are trying to obtain with the code? Kind regards, Xander
... View more
11-26-2014
04:34 AM
|
0
|
0
|
1485
|
|
POST
|
I have used this in the past: def main():
import arcpy
import os
# output file (change this)
report = r"D:\Xander\Domains\list_unused_domains.txt"
# database connection (change this)
conn = r"C:\Users\xbakker\AppData\Roaming\ESRI\Desktop10.2\ArcCatalog\Dev 10.2.sde"
# set encoding to utf-8 (for non ASCII chars)
import sys
reload(sys)
print sys.getdefaultencoding()
def_enc = sys.getdefaultencoding()
sys.setdefaultencoding('utf8')
with open(report, "w") as f:
f.write("Domains not in use\n")
# create list of domains
domains = arcpy.da.ListDomains(conn)
lst_names = [domain.name for domain in domains]
# list featureclasses
arcpy.env.workspace = conn
lst_fds = arcpy.ListDatasets(feature_type="feature")
lst_fds.append("")
lst_doms = []
for fds in lst_fds:
lst_fc = arcpy.ListFeatureClasses(feature_dataset=fds)
for fc in lst_fc:
try:
flds = arcpy.ListFields(os.path.join(ws, fds, fc))
for fld in flds:
if fld.domain != "":
lst_doms.append(fld.domain)
except:
pass
# process tables
lst_tbl = arcpy.ListTables()
for tbl in lst_tbl:
try:
flds = arcpy.ListFields(tbl)
for fld in flds:
if fld.domain != "":
lst_doms.append(fld.domain)
except:
pass
# create list of domains not in use
lst_notinuse = list(set(lst_names) - set(lst_doms))
# write to file
for dom in lst_notinuse:
f.write("{0}\n".format(dom))
# restore default settings
sys.setdefaultencoding(def_enc)
if __name__ == '__main__':
main() This does not get you the full list of domains that are in use. It is possible (and I have seen cases) where a column used with a default value in a subtype uses domain 'a' while the field itself uses domain 'b'. So if you have subtypes, you should check the domains in use by the subtypes too Use arcpy.da.ListSubtypes(featureclass). Kind regards, Xander
... View more
11-25-2014
12:42 PM
|
2
|
2
|
1433
|
|
POST
|
Did you define the symbology in your tool parameter settings or did you change the symbology manually after the run?
... View more
11-25-2014
10:59 AM
|
0
|
1
|
3470
|
|
POST
|
The solution in the Help for this problem states: Change the layer's renderer so that it uses one of the following supported renderers Simple Unique value (single field only, no groups) Class Breaks (graduated colors or graduated symbols) The Unique values can be used, if you add a new field and concatenate the fields you used in the renderer. Bare in mind that if there are many unique values, you may run into problems (and the result would not be very user friendly) Kind regards, Xander
... View more
11-25-2014
10:31 AM
|
0
|
0
|
664
|
|
POST
|
Hi Curtis, Alexander indicated that he has 180 polygons which define the areas to be used for the naming. No need for the Fishnet tool. In case he wouldn't have these polygons, the Fishnet would be a good way to name (group) the boxes based on location.
... View more
11-25-2014
05:43 AM
|
1
|
0
|
1895
|
|
POST
|
Does the geoprocessing service have a python script in the arcgisinput folder? If so, please have a look at the content of the script. It is very well possible that the paths that are appended are due to some changes occurred in the script during publishing.
... View more
11-25-2014
05:41 AM
|
0
|
0
|
1618
|
|
POST
|
If the source is contour lines digitized at 10K, with a precision of 0.5mm, this translates to 5m precision in the real world. Presenting it at a scale of 1:5000 will show the lines with 1mm error. You can create a DEM from the 10K contour lines and generate contour lines from that DEM with an interval that you can use at 5K. Be aware that in that process you will be presenting data at a higher precision than the original source is. So this is not recommended.
... View more
11-23-2014
07:28 PM
|
1
|
1
|
1188
|
|
POST
|
Did you check the content of the python script that is published to the server? ArcGIS will change some small things (settings) in your script during the publishing process to the server.
... View more
11-23-2014
07:11 PM
|
0
|
2
|
1618
|
|
POST
|
I am glad you figured it out and could resolve your problem. There are certainly a "few" enhancements that could be made with the exceptions. A generic error doesn't help much... Kind regards, Xander
... View more
11-21-2014
09:39 AM
|
0
|
0
|
2242
|
|
POST
|
Sounds pretty manual to me. Too bad you can't make use of the capabilities ArcGIS. I suppose one could write some Python code to find the shortest combined distance for the given points, but that would take some time or use ArcGIS Online to route the points.
... View more
11-21-2014
04:56 AM
|
0
|
0
|
1371
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-09-2020 09:26 AM | |
| 6 | 12-20-2019 08:41 AM | |
| 1 | 01-21-2020 07:21 AM | |
| 2 | 01-30-2020 12:46 PM | |
| 1 | 05-30-2019 08:24 AM |
| Online Status |
Offline
|
| Date Last Visited |
2 weeks ago
|