|
POST
|
Here are three things I would try: Use the @SHAPEXY token in your insert cursor, rather than the individual X and Y coordinates Explicitly set the output spatial reference environment as shown in the first response on this thread: Points added with da.InsertCursor have different coordinates than those used to create the point Create a PointGeometry object from your X and Y coordinates with the spatial reference defined, and insert that object as the @SHAPE in your insert cursor Good luck! Seems what you have written should just work. Micah
... View more
10-03-2019
11:12 AM
|
1
|
1
|
2428
|
|
POST
|
Ah nice. Let us know if that works. I think if you use arcpy.GetParameter you won't need to convert those values to float.
... View more
10-03-2019
08:55 AM
|
0
|
2
|
2428
|
|
POST
|
I really love where this thread has gone, especially since we all have to read code as well as write code. From my conversations with other professionals, a lot of people start out their GIS Python scripting journey by reading and modifying existing code to fix bugs, change variables, add tools, etc. Personally, I took a class in 2012 and more or less dove in. I made lots of mistakes along the way, and continue to do so! Referring to the example I gave to Robert: fc.split(".")[-1] is something I have typed many, many times, so placing it inside the format function makes sense to me. But Dan's example is indeed more readable. Anyways, folks might find this resource useful: Style Guide for Python Code by Guido van Rossum et al. Lots of good practical guidelines as well as philosophy. I googled 'Python Best Practices' after checking this thread this morning so I am going to check it out myself.
... View more
10-03-2019
07:21 AM
|
1
|
0
|
1057
|
|
POST
|
Totally - I get it. I applaud your efforts to simplify your code - it's easier to understand, maintain, and all around better that way.
... View more
10-02-2019
02:47 PM
|
0
|
0
|
3390
|
|
POST
|
Hey Robert, The important thing is that it works for what you need it to do. Your script looks good to me. Are you just trying to write it in fewer lines so you have a shorter script? It would be possible to accomplish what you are doing in the 'for' loop at line 13 in the 'for' loop before that one, but there's nothing wrong with the way you've done it! If you just want to write it in fewer lines, you could do this: import arcpy, os
workspace = r'Database Connections\Connection to dcp-gisapp1tst.sde'
walk = arcpy.da.Walk(workspace, datatype="FeatureClass")
for dirpath, dirnames, filenames in walk:
for filename in filenames:
fc = os.path.join(dirpath, filename)
print("{} is a {}".format(fc.split(".")[-1], arcpy.Describe(fc).shapeType) Micah
... View more
10-02-2019
01:02 PM
|
1
|
2
|
3390
|
|
POST
|
Hi Shannon, Sounds like you want your publication geodatabase updated in near real-time based on edits committed to your production geodatabase. I'd recommend reading through this section from Esri System Design Strategies, if you haven't already: GIS Data Administration - GIS Wiki | The GIS Encyclopedia. Based on your description, it sounds like either geodatabase or DBMS-tier replication would be your best bets. Scenarios using distributed data—ArcGIS Help | ArcGIS Desktop. I haven't set this up myself but it seems to serve the need of what you're looking for. This blog might help you in your journey: /blogs/HackingArcSDE/2015/01/01/geodatabase-replicationwithout-the-replication-part-1 Good luck! Let us know how it turns out. Micah
... View more
10-02-2019
07:43 AM
|
0
|
0
|
1320
|
|
POST
|
I think the examples shown for Walk—Help | ArcGIS for Desktop will get you what you need in terms of full paths. From there, you can use either the name or baseName property of your describe object: Describe object properties—Help | ArcGIS Desktop. Hope this helps! Micah
... View more
10-02-2019
07:28 AM
|
1
|
0
|
3390
|
|
POST
|
Glad to have helped, Brian McNamara. Happy scripting.
... View more
10-02-2019
07:14 AM
|
1
|
0
|
3809
|
|
POST
|
That helps! You're really close - we'll get ya sorted out. Assuming Criteria_1 and Criteria_2 are existing fields in your shapefile, I think you could ditch the codeblock parameter altogether and use something like this: expression_FinalScore = """!Criteria_1! * {} + !Criteria_2! * {}""".format(str(Parameter_1), str(Parameter_2))
arcpy.CalculateField_management(inFC, fieldName_FinalScore, expression_FinalScore, "PYTHON_9.3") As for your parameters, I believe that if you set the parameter type to "Double" in the script tool properties they will come in as the Python <float> type without any need to modify their types in the script. Micah
... View more
10-01-2019
11:16 AM
|
2
|
3
|
3809
|
|
POST
|
What happens when you run the script, Brian McNamara? That will help pinpoint the answer. As Joshua pointed out, you'll need to return the result of our Value() function. Put something like: return FinalScore inside of those triple quotes. Micah
... View more
10-01-2019
10:42 AM
|
1
|
0
|
3809
|
|
POST
|
Thanks Lance! I now see that in the field_is_required parameter description of the Add Field tool. Your explanation is far superior! This will save me a lot of confusion and investigation time at work. Cheers, Micah
... View more
07-25-2019
09:16 PM
|
0
|
0
|
4534
|
|
POST
|
I'm confused about the difference between two field properties: isNullable vs. required. Looking at the docs for a field object, I see both listed: isNullable: required: What is the purpose of having both of these properties? I ask because I am analyzing a dataset with a field where isNullable = True, and required = True. Shouldn't a field that allows null values be considered non-required? Thanks to anyone who can clear this up for me!
... View more
07-25-2019
02:54 PM
|
0
|
3
|
4724
|
|
POST
|
Outstanding, Blake Terhune! I saw you had provided a good answer to a question I posted a few years back about unused domains that included a link to this script. I'm getting it set up to work in my environment now. Thanks!
... View more
05-30-2019
10:29 AM
|
1
|
0
|
2118
|
|
POST
|
Mxdperfstat and System Test for the Web are Esri tools created by the Esri Professional Services team. Geocortex Analytics is developed by Latitude Geographics, an Esri Platinum partner. In addition to the tool Martin mentions you might also want to look at ArcGIS Monitor. Here's a blog post about it from last year: https://www.esri.com/arcgis-blog/products/arcgis-enterprise/administration/arcgis-monitor-a-proactive-approach-to-gis-implementation/
... View more
05-16-2019
07:32 AM
|
1
|
1
|
3804
|
|
POST
|
Glad to hear it! Since sometimes OID fields have a name besides OBJECTID, an even more robust approach would be: if (field01.type != 'OID'): Happy scripting, Doug.
... View more
05-07-2019
01:39 PM
|
1
|
0
|
6038
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-13-2017 09:58 AM | |
| 1 | 10-27-2017 12:54 PM | |
| 1 | 10-13-2017 04:28 PM | |
| 5 | 08-14-2017 01:58 PM | |
| 1 | 10-16-2017 08:03 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-26-2021
03:16 PM
|