|
POST
|
Firstly, using the syntax highlighting feature of GeoNet makes it much easier to share readable code. Next, you should print out the parameters you're using to create the connection file to make sure they are indeed what you want. You can also print arcpy.GetMessages() after you create the database connection to see if there are any errors or warnings from the tool. Finally, your validation is assuming os.getcwd() is the same as the ArcGIS relative Database Connections folder; I wouldn't be so confident. It would be better to check the same directory in which you created the database connection file. if arcpy.Exists(os.path.join(os.getcwd(), Connection_File_Name)):
... View more
03-09-2017
09:33 AM
|
1
|
0
|
2757
|
|
POST
|
After working with someone more experienced with PL-SQL, we found the "mutating" issue was with querying the A table that the trigger was supposed to be modifying. Our solution was to create a separate function to query the A table for the max ObjectID so the trigger didn't have to do it directly. CREATE OR REPLACE FUNCTION GIS.MaxObjectID(p_owner VARCHAR2, p_tablename VARCHAR2) RETURN NUMBER IS
max_objectid NUMBER;
regid NUMBER;
vc2SqlStr VARCHAR2(1000);
/******************************************************************************
PURPOSE: Allow EID triggers to find the max ObjectID in the base table
and the add table when determining if the EID value should be
updated. Without this check, modifying new features that have
not been compressed to the base table will get a new EID each
time an edit is saved (when a record is inserted into the add
table).
In the case of a brand new feature class without rows, the
NVL statement is needed to return 0 instead of -1 for the very
first record.
This function is meant to be used by EID triggers
across all schemas.
Takes input of schema owner and table name as separate
parameters. Has look-up in table registry for add table.
Returns the maximum ObjectID as a number or -1 if error.
******************************************************************************/
BEGIN
BEGIN
select tr.REGISTRATION_ID
into regid
from SDE.TABLE_REGISTRY tr
where tr.OWNER = p_owner and tr.TABLE_NAME = p_tablename;
EXCEPTION WHEN OTHERS THEN
regid := 0;
END;
vc2SqlStr := 'select NVL(max(objectid), 0) from (
select max(OBJECTID) as objectid from '||p_owner||'.'||p_tablename||
' union all
select max(OBJECTID) as objectid from '||p_owner||'.A'||regid||
')';
BEGIN
EXECUTE IMMEDIATE vc2SqlStr INTO max_objectid;
EXCEPTION WHEN OTHERS THEN
max_objectid := -1;
END;
RETURN max_objectid;
END MaxObjectID;
/ It returns the max ObjectID of whatever table you want or -1 if there was an error. Every trigger calls this function so we made it in a generic "GIS" schema. Here's an example of a trigger: CREATE OR REPLACE TRIGGER WS.HYDRANT_EID_TRG
BEFORE INSERT ON WS.A658 -- Add Table Name
for each row
declare
max_objectid WS.A658.objectid%type:=0;
begin
max_objectid := GIS.MaxObjectID('WS', 'HYDRANT_PNT'); -- Base Table Owner, Name
if max_objectid <> -1 and (:new.eid is NULL or :new.objectid > max_objectid) then
SELECT HYDRANT_EID_SEQ.NEXTVAL INTO :NEW.EID FROM DUAL;
end if;
end;
/
... View more
02-24-2017
01:51 PM
|
2
|
0
|
1824
|
|
POST
|
User has a single map document used for data edits. Workflow is that they create a new version for edits, open that mxd, right click database in table of contents to change the version, then continues edits. When using describe on a layer in the map that has had the version changed in this way, it drops the beginning of the path to the SDE connection. Is there a way to use ArcPy (ArcGIS 10.2.2) to get the SDE connection path of a layer in the MXD that had it's data source version changed?
... View more
02-24-2017
11:39 AM
|
0
|
0
|
840
|
|
POST
|
You'll probably need to manually fill the holes inside or else it's always going to consider those part of the feature when you run Dissolve. If you wanted to do it semi-manually, you can start editing and trace the boundary you want. Creating segments by tracing—Help | ArcGIS Desktop Also, you posted in the area for help using the GeoNet site. Tagging https://community.esri.com/community/gis/managing-data?sr=search&searchId=c25d959d-9dd7-4320-a287-94e58031f75a&searchIndex=0 for better visibility.
... View more
02-07-2017
01:43 PM
|
2
|
1
|
3893
|
|
POST
|
I don't know the intricacies of this script so I can't offer much advice on how to proceed. However, I suspect that it won't be as easy as changing the script tool parameters. You're likely going to have to rewrite some Python code in the script.
... View more
02-07-2017
11:01 AM
|
0
|
0
|
2913
|
|
DOC
|
As long as they are all in the same projection, they don't all have to be in Web Mercator. The catch is that they have to match the WKID of the Web Map's basemap, which means you have to use your own map service as a basemap (not an Esri basemap). We did this in our app but there are drawbacks. For example, the measure tool doesn't update until you click the map to end the measurement.
... View more
02-07-2017
10:18 AM
|
0
|
0
|
15862
|
|
POST
|
Ah, I see. In this case, it would be easiest to simply select by attributes where GPS_X is not null and GPS_Y is not null then perform the field calc you have and it will only affect the selected records.
... View more
02-07-2017
10:11 AM
|
0
|
0
|
2337
|
|
POST
|
By importing your shapefile to a file geodatabase and classifying the symbology category using unique values (one field) instead of unique values, many fields, I was able to get this script to run. The shapefile wasn't working because it doesn't specify if a field is nullable, which is something the script checks for. And the many fields symbology wasn't working because the script only has input for one symbology field. I specified the following script tool parameters. Here's the script output: Messages Executing: Script C:\Users\blaket\Downloads\RGB_values.mpk krpoly LIT_SIF Start Time: Tue Feb 07 10:28:20 2017 Running script Script... STARTED ====================================================================== C:\Users\blaket\Downloads\RGB_values.mpk\TempGDB.gdb Path: C:\Users\blaket\Downloads\RGB_values.mpk\testing.gdb\krpoly Spatial Reference: D48_Slovenia_TM LIT_SIF Type: Double Precision: 0 Scale: 0 Lenght: 8 Null: True TEMPS SET LIT_SIF_R field created LIT_SIF_G field created LIT_SIF_B field created ====================================================================== * FREQUENCIES & TEMP CARTO TILES - Symbology Frequency Analysis Completed - Temp Tile Feature Class: C:\Users\blaket\Downloads\RGB_values.mpk\TempGDB.gdb\TempTileFC - Temp Tile Feature Class Field Added:LIT_SIF - Centroid Feature Class For Raster:442035.953186113888.847687 ====================================================================== * LOOPING VALUES -------------- - Frequency Field Name:LIT_SIF - Frequency Record: 1.0 - Temp Layer:TempLayerClone1.0 - Calculate Tile Field Expression: '1.0' - Temp Tile: C:\Users\blaket\Downloads\RGB_values.mpk\TempGDB.gdb\TempTileFC - Layer Added - IS NOT TEXT - Layer Updated - Selection Qu:"LIT_SIF"=1.0 - Zoomed - RGB Raster Exported - RGB Raster: C:\Users\blaket\Downloads\RGB_values.mpk\TempRaster.tif - R: 120 - G: 179 - B: 157 - Selection: krpoly - Def: "LIT_SIF"=1.0 - Calculated & Cleared - Removed & Cleared -------------- - Frequency Field Name:LIT_SIF - Frequency Record: 2.0 - Temp Layer:TempLayerClone2.0 - Calculate Tile Field Expression: '2.0' - Temp Tile: C:\Users\blaket\Downloads\RGB_values.mpk\TempGDB.gdb\TempTileFC - Layer Added - IS NOT TEXT - Layer Updated - Selection Qu:"LIT_SIF"=2.0 - Zoomed - RGB Raster Exported - RGB Raster: C:\Users\blaket\Downloads\RGB_values.mpk\TempRaster.tif - R: 247 - G: 153 - B: 182 - Selection: krpoly - Def: "LIT_SIF"=2.0 - Calculated & Cleared - Removed & Cleared -------------- - Frequency Field Name:LIT_SIF - Frequency Record: 3.0 - Temp Layer:TempLayerClone3.0 - Calculate Tile Field Expression: '3.0' - Temp Tile: C:\Users\blaket\Downloads\RGB_values.mpk\TempGDB.gdb\TempTileFC - Layer Added - IS NOT TEXT - Layer Updated - Selection Qu:"LIT_SIF"=3.0 - Zoomed - RGB Raster Exported - RGB Raster: C:\Users\blaket\Downloads\RGB_values.mpk\TempRaster.tif - R: 142 - G: 182 - B: 237 - Selection: krpoly - Def: "LIT_SIF"=3.0 - Calculated & Cleared - Removed & Cleared -------------- ... snip ... Completed script Script... Succeeded at Tue Feb 07 10:30:02 2017 (Elapsed Time: 1 minutes 41 seconds)
... View more
02-07-2017
09:35 AM
|
1
|
2
|
2913
|
|
POST
|
Before you assign the new X and Y values to the point, just check if they have values. if row.GPS_X and row.GPS_Y:
# continue processing new XY coordinate
else:
# handle null XY coordinate values EDIT: Or better yet, use a where_clause parameter to just ignore the null values at the very beginning when creating the cursor. where_clause = "GPS_X is not null and GPS_Y is not null" UpdateCursor—Help | ArcGIS Desktop
... View more
02-07-2017
08:29 AM
|
0
|
2
|
2337
|
|
POST
|
It looks like either you're not entering a value for the FieldName parameter or it's not wired up correctly when you made the script tool. You can see when it prints the new R, G, and B fields it doesn't have to original FieldName with it (which it should). EDIT: I just noticed you're entering TEMPS SET as the FieldName. Field names cannot have spaces so double check that the field name is correct and that you're not using a field alias instead.
... View more
02-06-2017
09:59 AM
|
1
|
0
|
2913
|
|
IDEA
|
Rebuilding an address locator can sometimes fail and the details of how to create that locator are lost. Therefor, recreating the address locator each time instead of rebuilding is sometimes more convenient than rebuilding. When this process is scripted with Python, the default settings of an address locator often need to be changed after creation. Would be great to have access to these additional address locator settings through ArcPy. Related discussions: Modifying address locator settings using arcpy Is it possible to set address locator properties via arcpy? Rebuilding address locators Can't modify address locator
... View more
02-01-2017
10:39 AM
|
9
|
5
|
2716
|
|
IDEA
|
Rebuilding an address locator can sometimes fail and the details of how to create that locator are lost. Therefor, recreating the address locator each time instead of rebuilding is sometimes more convenient than rebuilding. When this process is scripted with Python, the default settings of an address locator often need to be changed after creation. Would be great to have access to these additional address locator settings through ArcPy. Related discussions: Modifying address locator settings using arcpy Is it possible to set address locator properties via arcpy? Rebuilding address locators Can't modify address locator
... View more
02-01-2017
10:39 AM
|
6
|
0
|
823
|
|
POST
|
Some sample data would help. I think I understand but it is a very unusual request and I want to make sure.
... View more
01-27-2017
04:03 PM
|
0
|
1
|
4936
|
|
POST
|
In Python, Joshua Bixby covers the options in this blog post. In SQL, you can do something like select count(*) from TableName where FieldName > 0 EDIT: Just to clarify your question, I will edit it for what I think you meant to say... I am wanting to calculate the count of rows in a field where designated fields in a feature class attribute table satisfy a query (in this case, where the value is greater than 0) and then write the count (sum) of the number of rows that satisfy this query into a new field.
... View more
01-27-2017
03:11 PM
|
1
|
4
|
4936
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | a month ago | |
| 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 |