|
IDEA
|
This is the same as https://community.esri.com/ideas/12779
... View more
05-17-2017
10:14 AM
|
0
|
0
|
877
|
|
POST
|
I've seen something similar and it turned out to be one layer in the map that was causing the problem. Try opening a blank map and add just the layers you are editing fresh from add data, not copied from the other map.
... View more
05-16-2017
09:49 AM
|
0
|
0
|
887
|
|
POST
|
It isn't obvious that it's GlobalID, but that error message does indicate there is a field with a unique constraint being violated by the data you are loading. In other words, check your table for unique key constrained fields and then join the two tables on that field to see if anything matches. If so, you need to pick one to delete.
... View more
05-16-2017
09:37 AM
|
0
|
0
|
1830
|
|
POST
|
You could dissolve the streets to get a list of unique names and number (enumerate) it to build a dictionary. Alternatively, if you're on an enterprise geodatabase, you could use SQL to get a distinct list of street names and include a row number.
... View more
05-16-2017
09:25 AM
|
0
|
0
|
1747
|
|
POST
|
I agree that https://community.esri.com/community/developers/gis-developers/python would probably be your best bet here. Are there any rules about the orientation of this irregular shape?
... View more
05-16-2017
08:23 AM
|
2
|
0
|
3196
|
|
POST
|
Our organization has chosen to create two related tables in our enterprise geodatabase: Scheduled Task Index and Scheduled Task Log The index table has a record for each script we run with a unique task id. The log table gets many records, each with a task id to identify what script wrote the log message; it also records the date/time. Every scheduled task script has a bit of code to write the success or failure (with error message) of the script to the log table. It also sends an email with the traceback information for debugging. We then have an email report that queries the log table for entries in the past 24 hours so we can easily see if anything failed.
... View more
05-15-2017
08:28 AM
|
0
|
0
|
2350
|
|
POST
|
What error message are you getting in Python? Can you post your code that constructs the file paths? How are you running this script, and with what user?
... View more
05-15-2017
08:23 AM
|
0
|
0
|
1078
|
|
POST
|
You could use the dissolve geoprocessing tool with Point as the dissolve field and and specify Date as the statistics field with the MAX statistic type. EDIT: Since you just want a flat file, you can save the dissolve output to memory, make a table view, export it to Excel, then clean up the mess.
... View more
05-12-2017
03:32 PM
|
2
|
0
|
8687
|
|
POST
|
If you're automatically posting the versions, keep in mind that there is no opportunity to review conflicts and that someone's unfinished edits might get posted and interpreted as final.
... View more
05-12-2017
09:07 AM
|
2
|
1
|
5143
|
|
POST
|
If there's no extra logic involved with getting the value, why not just look it up in the dictionary immediately instead of making a separate function? dict = {
"A": "A-150",
"B": "B-200",
"C": "C-250"
}
for n, i in enumerate(row):
if i:
row[n] = dict[i]
else:
row[n] = None Keep in mind that you will get a KeyError and the script will stop if i is not in the dictionary. You can use dict.get() and specify a default value if you want it to keep running.
... View more
05-11-2017
02:09 PM
|
0
|
0
|
951
|
|
POST
|
When configuring the query widget task with multiple filter expressions using the Ask For Values option, they are all required. Is it possible to make one filter with multiple filter expressions where each one is optional? My end goal is to have a search form where the user can choose one filter in which to enter a search value. Similar threads: https://community.esri.com/message/449679 Query Widget WAB - Required field
... View more
05-05-2017
09:35 AM
|
0
|
1
|
972
|
|
POST
|
Error: Schema is out of date, retry as owner or sdeadmin The owner of the data source must be the first user who opens the table in ArcCatalog, or open the table once the error has been encountered by any other users. The process of opening the table by the data source owner, correctly updates ArcGIS's metadata about the table's columns; these are maintained in the ArcSDE table column_registry. Add new columns to data sources by way of ArcCatalog to avoid this problem.
... View more
04-25-2017
11:18 AM
|
0
|
0
|
1400
|
|
POST
|
I've had trouble with e.message on the rare case when there is nothing in the message property from whatever raised the error. Sorry, I forgot what it was that didn't have a message property.
... View more
03-21-2017
09:50 AM
|
0
|
0
|
7788
|
|
POST
|
Check out Feature to Point and arcpy.mapping module.
... View more
03-15-2017
02:03 PM
|
0
|
0
|
1314
|
|
POST
|
Our organization hosts several geocode services from both regular and composite address locators. As we all should know, it is important to rebuild an address locator as changes are made to the reference data. Since the locator gets copied to the server, rebuilding the original locator is not sufficient so I've found the entire service needs to also be "rebuilt" (overwritten). We will create scheduled tasks that run a Python script to automate this process. Having experienced the nightmare that occurs when an address locator gets "corrupted" and cannot be rebuilt, I have made the choice to simply recreate the locator each time instead of rebuilding it. The advantage of this method is that you aren't dead in the water should something tragic happen to the original locator because the specifications for creating it are in the script. Alternatively, you could just ensure the specifications of the locator are well documented in the script and just do a rebuild. Either way, the geocode service still needs to get republished with the new address locator reference data. Here is a simplified process I use to rebuild a geocode service. Create temporary directory where the address locator and service definition files will be staged. This is cleaned up automatically when the script ends. Create address locator Create and analyze service definition draft file for sharing the address locator Modify Service Definition Draft file to overwrite the existing service. Convert Service Definition Draft to a Service Definition file Upload and publish service definition file as a service To clarify, this was all tested on 10.2.2. import arcpy
from contextlib import contextmanager
import datetime
import os
import shutil
import tempfile
import xml.dom.minidom as DOM ## sddTypeReplacement()
def main():
# Local variables
agsconn = r"C:\test\MyAdminArcGISServerConnection.ags"
sdeconn = r"C:\test\MySDEConnection.sde"
my_fancy_source_data = os.path.join(sdeconn, "my_fancy_source_data")
locator_name = "MY_FANCY_LOCATOR"
with makeTempDir() as temp_dir:
# Create address locator
temp_locator = os.path.join(temp_dir, locator_name)
field_info=(
"'Feature ID' OBJECTID VISIBLE NONE;"
"'*House Number' ADDR_NUM VISIBLE NONE;"
"Side <None> VISIBLE NONE;"
"'Prefix Direction' PRE_DIR VISIBLE NONE;"
"'Prefix Type' <None> VISIBLE NONE;"
"'*Street Name' NAME VISIBLE NONE;"
"'Suffix Type' STREET_TYPE VISIBLE NONE;"
"'Suffix Direction' SUF_DIR VISIBLE NONE;"
"'City or Place' <None> VISIBLE NONE;"
"'ZIP Code' <None> VISIBLE NONE;"
"State <None> VISIBLE NONE;"
"Longitude <None> VISIBLE NONE;"
"Latitude <None> VISIBLE NONE;"
"'Street ID' <None> VISIBLE NONE;"
"'Min X value for extent' <None> VISIBLE NONE;"
"'Max X value for extent' <None> VISIBLE NONE;"
"'Min Y value for extent' <None> VISIBLE NONE;"
"'Max Y value for extent' <None> VISIBLE NONE;"
"'Additional Field' <None> VISIBLE NONE;"
"'Altname JoinID' <None> VISIBLE NONE"
)
arcpy.CreateAddressLocator_geocoding(
"US Address - Single House", ## in_address_locator_style
"'{}' 'Primary Table'".format(my_fancy_source_data), ## in_reference_data
field_info, ## in_field_map
temp_locator
)
# Create and analyze service definition draft file
sddraft = os.path.join(temp_dir, locator_name+".sddraft")
sdd_analyze_result = arcpy.CreateGeocodeSDDraft(
temp_locator, ## in_address_locator
sddraft, ## out_sddraft
locator_name, ## service_name
"FROM_CONNECTION_FILE", ## server_type
agsconn, ## connection_file_path
folder_name="Geocoders",
summary="Created by Python script {}".format(
datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
)
)
# Inspect analyze result
"""result object of CreateGeocodeSDDraft is a dictionary of dictionaries structured like
{
'errors': {},
'messages': {},
'warnings': {
(u'Warning message', 9999): [],
(u'Warning message', 9999): []
}
}
"""
## Check for error messages to create the issues list.
## If there are no analyze errors, analyze_issues will be empty list []
analyze_issues = sdd_analyze_result.get("errors").keys()
## Check for warning messages and add them to the issues list.
## Only include those that aren't in the ignore list.
warn_ignore = [
('Missing Summary in Item Description', 97),
('Missing Tags in Item Description', 98),
('Locator will be copied to the server', 24044)
]
analyze_issues += [
warn for warn in sdd_analyze_result.get("warnings").keys()
if warn not in warn_ignore
]
if analyze_issues:
raise Exception(
"Analyzing the service definition draft revealed an issue.\n"
"{}".format(analyze_issues)
)
else:
# Modify Service Definition Draft file to overwrite the existing service
sddTypeReplacement(sddraft)
# Convert Service Definition Draft to a Service Definition file.
## Staging compiles all the necessary information needed to publish
## the GIS resource. If your data is not registered with the server,
## the data will be added when the Service Definition Draft file is staged.
service_definition = os.path.join(temp_dir, locator_name+".sd")
arcpy.StageService_server(sddraft, service_definition)
# Upload and publish service definition file as a service
arcpy.server.UploadServiceDefinition(service_definition, agsconn)
return arcpy.GetMessages()
## end if analyze_issues
## end with temp_dir
def sddTypeReplacement(service_definition_draft):
"""Modifies a service definition draft file to overwrite an existing service
instead of the defaut to create a new service.
This function based on Esri example code for arcpy.UploadServiceDefinition_server()
Requires module xml.dom.minidom as DOM
Takes string input parameter of the path to a service definition draft file.
I did test overwriting a service without this function and it seems to
work fine. However, I kept it because Esri took the effort to post the
code example in the documentation and there must be a good reason.
Futher investigation may be helpful in understanding this.
"""
xml_doc = DOM.parse(service_definition_draft)
descriptions = xml_doc.getElementsByTagName("Type")
for desc in descriptions:
if desc.parentNode.tagName == "SVCManifest":
if desc.hasChildNodes():
desc.firstChild.data = "esriServiceDefinitionType_Replacement"
with open(service_definition_draft, 'w') as f:
xml_doc.writexml(f)
@contextmanager
def makeTempDir():
"""Creates a temporary folder and returns the full path name.
Use in with statement to delete the folder and all contents on exit.
Requires contextlib contextmanager, shutil, and tempfile modules.
"""
temp_dir = tempfile.mkdtemp()
try:
yield temp_dir
finally:
shutil.rmtree(temp_dir)
# Script start
if __name__ == '__main__':
main() I will be also adapting this same process for rebuilding geocode services with a composite locator. As always, suggestions are welcome! P.S. When I got this vague error, I found it was caused by incorrect field names in the field info for the in_field_map parameter of arcpy.CreateAddressLocator_geocoding() ERROR 000042: Failed to create the address locator. Underlying DBMS error [ORA-00923: FROM keyword not found where expected]
... View more
03-10-2017
01:11 PM
|
2
|
5
|
6688
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 07-10-2026 07:32 AM | |
| 1 | 10-23-2025 03:53 PM | |
| 1 | 04-28-2026 07:25 AM | |
| 1 | 03-19-2026 08:59 AM | |
| 1 | 02-12-2026 01:37 PM |