POST
|
Similar to the fields "Shape length" and "Shape area" which automatically update when you cut the polygon I’d like to create a field which automatically update when you change the value of e field in the same table. The calculation would base on several fields of the same table. Therefore, it would be like a field-calculator calculation which automatically starts when you change one of the values the calculation is based on. Is this possible?
... View more
12-04-2020
07:35 AM
|
0
|
1
|
2429
|
POST
|
Hello Jake Thank you for your recommendation. I forgot to write that I use the Basic license. Therefore I can't use mosaic dataset.
... View more
12-14-2018
07:23 AM
|
0
|
0
|
432
|
POST
|
Hello, I use a File Geodatabase Raster Catalog (unmanaged) to display the aerial images in arc map. Normally it works perfect and fast. But recently some problems occured. During the use of the ArcMap some parts of the images disappeared (not only some whole images but also some parts of images) and there was only the blank background. All the other layers (stored in FileGDB's) still worked perfectly. While continuing using the document, sometimes some other parts of the images disappeared. I tried to turn off and on the Layer and other things but it didn't help. The only thing I could do was to save the document, close and reopen it. Then all the images were shown again - until the next time of Disappearence. Sometimes I can work an hour without problems, sometimes only 5 min. The problem occurs in several map documents. Thanks for your advice! I use ArcGIS for Desktop 10.3.0.4322
... View more
12-13-2018
09:01 AM
|
0
|
2
|
503
|
POST
|
Thank your for all those tips! Concerning 3. str.format: is there a way to put together two strings and when one of them is "NULL/empty", ignore it and only take the "not empty" string?
... View more
12-06-2018
10:20 AM
|
0
|
1
|
1101
|
POST
|
Hey Joshua Thank you a lot for all of your help! After several hours of code typing, (at least in my opinion / compared to the excel-code) a kind of large code and several things not working (properly), I asked myself if there might be an easyer way to write the code. That's why I started thinking if I'm actually really using the easyest way to do it and therefore I opened this new thread. I'm not sure if that makes a difference: I'm using ArcGIS 10.3 with python 2.7.8. I imported my example-table as a table to a GDB and run your code. It did not work: "Messages Executing: CalculateField Tabelle Field_6 compare(!Field_1!, !Field_2!, !Field_3!, !Field_4!, !Field_5!) PYTHON_9.3 "def combine (fld1, fld2, fld3, fld4, fld5):\n part1 = (\n fld3 \n if fld1 == 617\n else fld2\n )\n part2 = (\n (\n u"Sometext"\n if fld5 is None\n else u"Someothertext" + fld5\n )\n if fld4 == u"ABC"\n else u"Sometext"\n )\n\n return u"{} | {}".format(part1, part2)" Start Time: Thu Dec 06 11:04:19 2018 ERROR 000539: Error running expression: compare(612.0, u"from July 1", u"April to November", u"ABC", u"TextWith_äöü") Traceback (most recent call last): File "<expression>", line 1, in <module> TypeError: compare() takes exactly 3 arguments (5 given) Failed to execute (CalculateField). Failed at Thu Dec 06 11:04:19 2018 (Elapsed Time: 0.02 seconds)" I can't figure out why it thinks that not all the arguments would be used...? Anyway, I tried to simplify my code based on your model. This works perfectly: def compare(Code, SchnittZP, WeideZP, NHG_YN):
part1 = (
"-"
if Code in (921, 922, 923, 924)
else "ERROR"
)
return part1 then I tried to enter an other argument (line 6+7) - resulting in an error "ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 7) Failed to execute (CalculateField). ": def compare(Code, SchnittZP, WeideZP, NHG_YN):
part1 = (
"-"
if Code in (921, 922, 923, 924)
"Text 634"
elif Code == 634
else "Wrong code"
)
return part1p So I thought, maybe I need to adjust the whole code like this: def compare(Code, SchnittZP, WeideZP, NHG_YN):
part1 = (
if Code in (921, 922, 923, 924):
"-"
elif Code == 634:
"Text 634"
else:
"Wrong code"
)
return part1 because I've never seen the order you put the result bevore the condition. (What's the difference? Why do you prefer result bevore condition? How can you enter en elif-statement?) Anyway it gives back following error: "Runtime error Traceback (most recent call last): File "<string>", line 56, in <module> File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\management.py", line 3453, in CalculateField raise e ExecuteError: Failed to execute. Parameters are not valid. ERROR 000989: Python syntax error: Parsing error SyntaxError: invalid syntax (line 4) Failed to execute (CalculateField). " I tried to handle this by changing row 4 to value = "-" and in the end "return value" but it didn't change anything. Thanks for the other useful hints about "my concerns"! I will try to implement some of your hints and explain my problems with unicode later 🙂
... View more
12-06-2018
02:32 AM
|
0
|
1
|
1101
|
POST
|
Is there a way to convert the code from excel to arcgis? Because if not I will have to export the feature class-table to excel, apply the codes and join the new table to the feature class every time I change some data. That's what I try to avoid.
... View more
12-06-2018
12:09 AM
|
0
|
0
|
1101
|
POST
|
Hello, I'd like to do some complicated field calculation. I want to calculate the Field 6-value (see table below, representing a FeatureClass table) as follows: If Field 1 = 617: Field 3-value Else: Field 2-value AND "|" AND If Field 4 = ABC: If Field 5 is Null: "Sometext" Else: "Someothertext" + Field 5 Else: I entered the results in Field 6 as an example Field 1 Field 2 Field 3 Field 4 Field 5 Field 6 611 from July 1 April to November TextWith_äöü from July 1 | Sometext 612 from July 1 April to November ABC TextWith_äöü from July 1 | Someothertext TextWith_äöü 612 from July 15 April to November ABC from July 15 | Someothertext 617 from July 1 April to November ABC April to November | Someothertext Up until now, I exported the table and calculated the value with some "when"-statements in Excel. But since I'd like to have the results in GIS i searched for an other solution. I ended up using "arcpy.CalculateField_management" and something like this: def compare(class1, class2, class3):
if class1 in (612, 611):
return class2
elif class1 == 617:
return class3
else:
return class1
# Expression below
compare(!some_field!, !another_field!, !another_field2!) This didn't work quite well because - the code will become huge (I have more fields and values to compare) - there seem to be problems with converting/using characters which don't fit into ASCII - i couldn't figure out how to ask properly if Field 5 is Null - I could not properly translate the "AND" and the "OR" from Excel to Python (for example: If Field 4 is Null AND Field 5 is Null AND Field 1 is 612, Field 6 = ...) -... Is there an other, easyer solution how I can calculate Field 6 value? Thanks a lot for your help!
... View more
12-05-2018
07:08 AM
|
1
|
10
|
1741
|
POST
|
I thought I found the solution: return arcpy.CalculateField_management(fc, field, "!AnotherFieldName!", "PYTHON_9.3", "") But this calculates new values for the whole table instead of only for the ones with value 612 in "field" Any idea? Thanks for your help!
... View more
12-04-2018
05:40 AM
|
0
|
1
|
927
|
POST
|
thanks for your help the problem ist that I don't want to return the value from the field I'm comparing with but the value from an other field in the same table. That's why I tried to use !"AnotherFieldName"! with those "!!"
... View more
12-04-2018
04:56 AM
|
0
|
1
|
927
|
POST
|
Hello I use a python script to compare the value of a field like follows: def compare(class1):
if class1 in (612, 611):
return "Text1"
elif class1 == 617:
return "Text2"
else:
return !Field! (followed by arcpy.CalculateField_management....) this works perfectly to return a standardized text like "Text 1" or "Text 2". But what I really want to do is I want to return a field-value instead of a text. If (612, 611) return Field1-value; if (617) return Field2-value. I tried it with !Field! instead of "Text 1" but it didn't work. What's the code to return a fieldvalue instead of text? Thanks for your help!
... View more
12-04-2018
03:36 AM
|
0
|
6
|
1285
|
POST
|
Hello Is it possible to directly access a FileMaker Database from ArcGiS? I installed the ODBC-Driver for both programs but I could not figure out how I can "add" the FileMaker-data into ArcMap. Is it also possible to Edit Data in the FileMaker Database directly in ArcGIS? Thank you for your help! I use ArcGIS 10.3 and FileMaker Pro 16
... View more
11-28-2018
02:34 AM
|
0
|
3
|
2457
|
POST
|
Late but in case anyone still googles for the solution: You can create a new line Feature Class, edit it, select and copy the polygons and paste them to the line FC. If you want to keep some attributes, you should create the attributes (same type and name) in the line FC first.
... View more
05-02-2018
02:11 AM
|
1
|
0
|
827
|
POST
|
Ok, I solved it diffrently: I made a Batch-Script: for /R C:/Path %%f in (*.ec*) do copy %%f C:/Path2/ So now I copy all the files from the folder with those many subfolders to one single folder. It works fine. The only sad thing is that I now do have two folders with all those images... but still much better than doing all this manually... If someone knows about an other method without copying the files, I would still be interested in the solution.
... View more
06-21-2016
07:44 AM
|
0
|
0
|
902
|
POST
|
Yes, I can set the symbology manually. But I'll have to do so for about 100 Rasters, which really sucks. And I'll have to do it at least once a year. I tried to use a Raster Catalog. But this enlarged the Data (from 8G to 130G) and was extremely slow. I can't create a MosaicDataset because I run on basic licence.
... View more
06-21-2016
12:52 AM
|
0
|
0
|
902
|
Title | Kudos | Posted |
---|---|---|
1 | 04-08-2015 09:34 AM | |
1 | 12-05-2018 07:08 AM | |
1 | 05-02-2018 02:11 AM |
Online Status |
Offline
|
Date Last Visited |
12-04-2020
09:13 AM
|