|
POST
|
Don't think so. One option would be to load it in with a large point symbol. Would look just like a circular buffer around each point if you make the fill color null. Can make the point size relative to a field, so if you have the miles column, use that to get the varying sizes. http://resources.arcgis.com/en/help/main/10.1/index.html#//00q8000000st000000 Can then save as a layer file, and load that into ArcMap instead of the shapefile directly. this will apply your symbology. R_ Also, keep in mind that there are python shapefile libraries out there that allow you to create any geometry shapefile with just python, so could make them as polygons off the get go.
... View more
07-31-2013
11:46 AM
|
0
|
0
|
1066
|
|
POST
|
wasn't sure what/why you were hacking the paths and such, but after re-reading, I think you are just trying to process the polygons that start with SAB or APE if they are not in a directory named "ARCHIVE". If this is true, try something like this:
import arcpy, os
#Set the workspace
workspace = r"D:/Work"
appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\appendFC"
outFC = r"\\in_memory\centerPoints" # make this an in memory dataset is faster. no need to write to disk if you are just deleting it.
#create list of files from directories and subdirectories
for dirpath, dirnames, filenames in arcpy.da.Walk(workspace,topdown=True, datatype="FeatureClass", type="Polygon"):
if "ARCHIVE" in dirnames:
dirnames.remove('ARCHIVE')
for filename in filenames:
if filename.startswith("APE") or filename.startswith("SAB"):
if arcpy.Exists(outFC):
arcpy.Delete_management(outFC) # if you are emptying it always, no need to check for size, just delete it if exists.
# convert to points
arcpy.FeatureToPoint_management(os.path.join(dirpath,filename), outFC, "INSIDE")
# append to final FC
arcpy.Append_management(outFC, appendFC)
If "ARCHIVE" is not a folder, but is included in a folder path somewhere, you could still put the if "ARCHIVE" not in code from my previous post. If it is a folder, the way I have it coded, it should removed that directory before walking through the FCs. R_
... View more
07-31-2013
11:36 AM
|
0
|
0
|
2305
|
|
POST
|
Something like this? Hopefully, you have the same attribute names, type, etc in each of the FC's you are converting to point. Then, you would create an empty FC with the attribute table already set up and just append to it without having to worry about field mappings. will call it appendFC for clarity.
import arcpy, os
#Set the workspace
workspace = r"D:/Work"
appendFC = r"C:\TEMP\PDX_SAB\PDX_SAB.gdb\appendFC"
outFC = r"\\in_memory\centerPoints" # make this an in memory dataset is faster. no need to write to disk if you are just deleting it.
#create list of files from directories and subdirectories
for root, dirs, files in arcpy.da.Walk(workspace, datatype="FeatureClass", type="Polygon"):
for name in files:
if name.startswith("APE") or name.startswith("SAB"):
path = os.path.abspath(os.path.join(root, name))
for x in path:
if "ARCHIVE" not in x:
# empty the output feature class before adding new data
if arcpy.Exists(outFC):
arcpy.Delete_management(outFC) # if you are emptying it always, no need to check for size, just delete it if exists.
# convert to points
arcpy.FeatureToPoint_management(path, outFC, "INSIDE")
# append to final FC
arcpy.Append_management(outFC, appendFC)
R_
... View more
07-31-2013
11:11 AM
|
0
|
0
|
2305
|
|
POST
|
Try this:
import arcpy
from arcpy import *
import sys
arcpy.env.workspace = r"c:\connectionFiles\conntop10sig.sde"
sql = "select * from TOP10_SIG.DBO.ABCBNIVL where TOP10_SIG.DBO.ABCBNIVL.TYPECBN = 3"
sdeConn = arcpy.ArcSDESQLExecute(r"c:\connectionFiles\conntop10sig.sde")
print "Execute SQL Statement: ", sql
print "connecting to dba"
sdeReturn = sdeConn.execute(sql)
if isinstance(sdeReturn, list):
print "Number of rows returned by query: ", len(sdeReturn), "rows"
for row in sdeReturn:
print row
else:
print "no selection made" If you are still getting errors, you need to confirm that there is a numeric field named TYPECBN in the table named TOP10_SIG.DBO.ABCBNIVL in the sde connection r"c:\connectionFiles\conntop10sig.sde". Look in ArcCatalog and make sure that TOP10_SIG.DBO.ABCBNIVL is listed as the table name there. If so, and still getting errors, you might try dropping the DBO from it ( TOP10_SIG.ABCBNIVL ) as I have seen in the FlexApp environment where links to DBO tables didn't work with that in the path. R_
... View more
07-31-2013
10:15 AM
|
0
|
0
|
2919
|
|
POST
|
To write to the FGDB table you can do it several ways. If you are modifying data in an existing row, you could use updateCursor, or calculatefield. If you are adding new rows to the table, you want InsertCursor http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000014000000 http://resources.arcgis.com/en/help/main/10.1/index.html#//00170000004m000000 R_ Also, keep in mind that the da.walk with topdown set as true, you can remove any of the directories from the walk list. you say you need to drill down, but if you don't need to drill into ALL subdirs, this can be done with da.walk. The bottom example here http://resources.arcgis.com/en/help/main/10.1/index.html#//018w00000023000000 shows that with the dirnames.remove statement.
... View more
07-31-2013
09:53 AM
|
0
|
0
|
3877
|
|
POST
|
The values entered are returned. I entered 1 for RMS and F for Classification. The initial whereClause runs fine, until a null value is encountered. I believe the issue is still with the UpdateCursor. I have gone back and attempted to work with the previous suggestions, but to not avail. The results are still the same, no errors, and no results. I know how to fix the null vs blank problem using field calculator, but not with a script. Other suggestions? import arcpy RMS = arcpy.GetParameterAsText(0) Classification = arcpy.GetParameterAsText(1) mxd = arcpy.mapping.MapDocument("CURRENT") df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0] fc = arcpy.mapping.ListLayers(mxd, "Region", df)[0] arcpy.AddMessage(str(RMS)) arcpy.AddMessage(str(Classification)) #Logic try: whereClause = ''' "RMS" = '{0}' AND "Classification" = '{1}' '''.format(RMS, Classification) arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", whereClause) df.extent = fc.getSelectedExtent() df.scale = df.scale*1.1 arcpy.SelectLayerByAttribute_management(fc, "CLEAR_SELECTION", whereClause) sql = "{0}".format(arcpy.AddFieldDelimiters(Region, RMS, Classification)) + " IS NULL" # not sure what the output of this is,is it valid sql? in either case, Region variable is not defined cursor = arcpy.da.UpdateCursor(fc, "RMS", sql) # the region layer has been set to variable fc. for row in cursor: row[0] = "" cursor.updateRow(row) del row, cursor except: print arcpy.GetMessages() If it were me, I'd make a copy of my data and try to get the updateCursor working WITHOUT the where clause ( cursor = arcpy.da.UpdateCursor(fc, "RMS") ). run it with row[0] = "test" then with row[0] = "" # of course, all this assumes the "Region" field is a text field... Once you get it working for ALL rows in the table, then I'd figure out the proper where clause to put in there. A lot of time, select/copy/paste each line in the IDLE window and running it will often give an idea of what is going wrong. Also, in the IDLE, you can type "print variable" (I.e. >>>print RMS ) at any time to see the value that is currently assigned to it. Also "type(variable)" will give you the variable type to ensure it is the proper input for a tool. On another note, you said you could calculate it, but want to do it with python, why not: arcpy.CalculateField_management(fc, "RMS", "\\"", "PYTHON_9.3") Also, your selectLayerbyAttributes is putting a selection on the fc before the cursor. Documentation for UdateCursor doesn't say if it honors selections or not, but you might try to clear selection before the updatecursor. R_
... View more
07-31-2013
09:38 AM
|
0
|
0
|
3564
|
|
POST
|
James, You would go into ArcCatalog, Database Connections, Add Database Connection and set it up to your database. Then you can reference as such:
indatabase = "Database Connections\\Connection to RCES_P.sde\\SIS_ADM.IMAGES" # can use the database connection
indatabase = "C:\\Users\\rkzufelt\\AppData\\Roaming\\ESRI\\Desktop10.1\\ArcCatalog\\Connection to RCES_P.sde\\ARCUPDATE.MAPS" #or the database connection file
R_
... View more
07-31-2013
08:50 AM
|
0
|
0
|
3877
|
|
POST
|
No mistake, you are correct. there is a bug in the describe function (on version 10.0, 10.1 and 10.2) Hopefully they will address it. Here is the tech support info if it helps: [#NIM088547 Using the describe properties to pull the spatial reference on a TIN fails with AttributeError: DescribeData: Method SpatialReference does not exist.]
I added this incident to the list of affected users. In the bug report, I also added the properties extent, MExtent, and ZExtent to the list of unsupported dataset properties for TINs.
For a work-around, this is cumbersome, but you could create a new shapefile or feature class, setting the spatial reference to that of the TIN, then query the spatial reference properties of the new shapefile. For instance:
relPath = os.path.dirname (sys.argv[0]) # script path tin = os.path.join (relPath, "lido_TIN") arcpy.CreateFeatureclass_management (relPath, "abc.shp", "POINT", spatial_reference = tin) shp = os.path.join (relPath, "abc.shp") desc = arcpy.Describe (shp) arcpy.AddMessage ("spatialReference: " + str (desc.spatialReference.name)) arcpy.Delete_management (shp)
R_
... View more
07-30-2013
03:51 PM
|
0
|
0
|
788
|
|
POST
|
well, my config is in the eSearchWidget.xml I set this: <popupsdisabled>true</popupsdisabled> (by default it is false). That is the only change needed to the eSearchWidget. Here is one of my popupconfig files, though you will need to customize it using your data. Best to go to the rest endpoint for your service in the browser and copy/paste the field names, as misspelling/CaSe issues are the most common mistake setting these up. Can follow the link at the bottom of the popupconfig to see the documentation for it (this example doesn't utilize attachments or photos or related records).
<?xml version="1.0" ?>
<configuration>
<title>{OSE_ID}</title>
<fields>
<field name="OSE_ID" alias="OSE_ID" visible="true" />
<field name="CLASSIFICATION" alias="CLASSIFICATION" visible="true" />
<field name="REMOVAL_ACTIVITIES" alias="REMOVAL_ACTIVITIES" visible="true" />
<field name="MRSTEW_DESC" alias="MRSTEW_DESC" visible="true" />
<field name="DESG_AREA" alias="Designated Area" visible="true" />
<field name="OPER_UNIT" alias="Operable Unit" visible="true" />
<field name="OSE_REPORT" alias="OSE Report" visible="true" />
<field name="MRSTEW_COMMENT" alias="MRSTEW_COMMENT" visible="true" />
<field name="TURNOVER_AREA" alias="Turnover Area" visible="true" />
<field name="PHOTOS" alias="PHOTOS" visible="false"/>
<field name="PHOTO" alias="PHOTO" visible="false"/>
<field name="GALLERY" alias="GALLERY" visible="false"/>
<field name="GALLERY2" alias="GALLERY2" visible="false"/>
<field name="NORTHING" alias="Northing" visible="true">
<format precision="0" usethousandsseparator="true" />
</field>
<field name="EASTING" alias="Easting" visible="true">
<format precision="0" usethousandsseparator="true" />
</field>
<field name="DATE_REMOVED" visible="true">
<format dateformat="shortDate" useutc="true" />
</field>
</fields>
<medias>
</medias>
<showattachments>false</showattachments>
<showrelatedrecords>false</showrelatedrecords>
</configuration>
<!--
See pop-up documentation at
http://resources.arcgis.com/en/help/flex-viewer/concepts/index.html#/Pop_up_configuration_files/01m30000002q000000/
-->
The link will also show examples of how to load the layer(s) within the config.xml to "assign" the proper popupconfig.xml file. R_
... View more
07-30-2013
02:09 PM
|
0
|
0
|
2275
|
|
POST
|
Sure, I have done it a couple ways: Assuming the networked computer is named "server1" and has a share named "U" and/or is mapped to drive U:
import arcpy
workspace = arcpy.env.workspace = r"U:" ## don't put the slash at the end.....
workspace = arcpy.env.workspace = r"\\server1\U"
either works. Keep in mind, though, setting it to the base level, by default, will drill down into all directories in there as well, so it can take a long time if there is much there. Better to set it to a working folder on the drive. Mine is still running as it is categorizing my entire drive. R_ When topdown is True, the dirnames list can be modified in-place, and Walk() will only recurse into the subworkspaces whose names remain in dirnames. This can be used to limit the search, impose a specific order of visiting, or even to inform Walk() about directories the caller creates or renames before it resumes Walk() again. Modifying dirnames when topdown is False is ineffective, because in bottom-up mode the workspaces in dirnames are generated before dirpath itself is generated.
... View more
07-30-2013
02:01 PM
|
0
|
0
|
3877
|
|
POST
|
Thanh, If you are searching layers that are visible in the flexviewer map, this is how I handle that. in the eSearchWidget.xml I set this: <popupsdisabled>true</popupsdisabled> That way, you will not get the popup when clicking on the results table or grid, it will, however, zoom you to the clicked feature. Then, I configure a popup in the config.xml for that layer. that way, any time you click on the feature, you will get the popup that honors the fields/formatting in the popupconfig.xml file. I figure since the table/grid is giving me "most" the info, I don't need it to automatically popup a window with the same info. However, the popupconfig file lets you configure whatever info you want displayed, and only displays on click. R_
... View more
07-30-2013
01:41 PM
|
0
|
0
|
2098
|
|
POST
|
You should have what you need to get it working. If not, after these two lines: RMS = arcpy.GetParameterAsText(0) Type = arcpy.GetParameterAsText(1) could you print them out to see what is getting reported? print RMS print Type also, I don't believe "Type" is a reserved word, but it is generally a bad idea to use variable with names the same as built in functions as it can mask or overwrite the built in function(s). Type(RMS) in python gives the "type" of object assigned to the RMS variable. Also, what is the format of the "Regions" layer? FGDB, oracle spatial table, etc.? I ask as there is a bug in the update cursor and will not work on external database tables that are not registered. In this case, I have to actually use the oracle module for python. R_
... View more
07-30-2013
01:27 PM
|
0
|
0
|
1649
|
|
POST
|
Perhaps because it is formatted incorrectly.
updateRows = arcpy.da.UpdateCursor(fc, RMS + " IS NULL", "", RMS)
UpdateCursor (in_table, field_names, {where_clause} , {spatial_reference}, {explode_to_points}, {sql_clause})
so maybe something like:
updateRows = arcpy.da.UpdateCursor(fc,"RMS",RMS + " IS NULL")
It appears as if you where clause and fields are transposed and no quotes around the field attribute so was looking for the variable RMS. of course, with your where clause, you still need to define RMS, so maybe that part doesn't matter. R_
... View more
07-30-2013
10:08 AM
|
0
|
0
|
1915
|
|
POST
|
For me, one of the other nice features of the Dynamic legend was the nice white background that the OOB doesn't have. Can modify the bottom of the OOB LegendWidget.mxml to this to get the white box that the dynamic legend has:
<viewer:WidgetTemplate id="wTemplate">
<s:Rect bottom="0"
left="0"
right="0"
top="0">
<s:stroke>
<mx:SolidColorStroke
alpha="{getStyle('borderAlpha')}"
color="{getStyle('borderColor')}"
weight="1"/>
</s:stroke>
<s:fill>
<s:SolidColor alpha="1" color="0xffffff"/>
</s:fill>
</s:Rect>
<esri:Legend id="myLegend"
width="100%" height="100%"
top="10"
respectCurrentMapScale="{respectCurrentMapScale}"/>
</viewer:WidgetTemplate>
R_
... View more
07-30-2013
09:26 AM
|
0
|
0
|
1034
|
|
POST
|
I have had the same error with the exportToJpeg tool when I was trying to assign an invalid filename ( 100-B/C.jpg ). It didn't like the slash in the filename and give me the NoneType error. Doesn't appear as if this is the case here...... R_
... View more
07-30-2013
09:15 AM
|
0
|
0
|
872
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-14-2026 04:00 PM | |
| 1 | 09-14-2022 07:53 AM | |
| 1 | 09-14-2022 08:23 AM | |
| 1 | 05-21-2026 08:53 AM | |
| 1 | 05-14-2026 04:28 PM |
| Online Status |
Online
|
| Date Last Visited |
yesterday
|