Skip to content

Commit

Permalink
using fields and groups (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
procrastinatio authored Jul 1, 2024
1 parent 3765fa7 commit 22cf03b
Show file tree
Hide file tree
Showing 3 changed files with 44,734 additions and 44,162 deletions.
18 changes: 11 additions & 7 deletions SymbolsFilter.pyt
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ def get_query_defn(data):


def get_columns(renderer, layername):
columns = renderer.get("headings")
columns = renderer.get("fields")

if columns is None or None in columns:
logger.warning(f"No headings found for {layername}: {columns}")
logger.warning(f"No fields found for {layername}: {columns}")
else:
columns = list(map(get_last_element, columns))
return columns
Expand Down Expand Up @@ -360,9 +360,12 @@ class SymbolFilter:
feature_class_path = dataset

# headers
values = []
labels = []
columns = get_columns(renderer, layername)
values = renderer.get("values")
labels = renderer.get("labels")
for grp in renderer.get("groups", []):
values += grp.get("values", [])
labels += grp.get("labels", [])

sql = get_query_defn(data)
messages.addMessage(f" sql={sql}")
Expand All @@ -387,7 +390,9 @@ class SymbolFilter:
gdf = gdf.merge(df, left_on="FORM_ATT", right_on="UUID")

# TODO Attribut SEEBODEN???
if not "Deposits_Chrono" in layername: # "Quelle" in layername:
if (
not "toto" in layername
): # Deposits_Chrono" in layername: # "Quelle" in layername:
features_rules_sum = 0
if columns is None or any(col is None for col in columns):
messages.addErrorMessage(
Expand Down Expand Up @@ -449,10 +454,9 @@ class SymbolFilter:
)
results[label] = count


filtered[layername] = results
messages.addMessage(
f" ----------\n{feat_total : >10} in selected extent (with query_defn)".encode(
f" ----total------\n{feat_total : >10} in selected extent (with query_defn)".encode(
"cp1252"
)
)
Expand Down
2 changes: 1 addition & 1 deletion SymbolsFilter.pyt.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0"?>
<metadata xml:lang="en"><Esri><CreaDate>20240625</CreaDate><CreaTime>10371500</CreaTime><ArcGISFormat>1.0</ArcGISFormat><SyncOnce>TRUE</SyncOnce><ModDate>20240627</ModDate><ModTime>213554</ModTime><scaleRange><minScale>150000000</minScale><maxScale>5000</maxScale></scaleRange><ArcGISProfile>ItemDescription</ArcGISProfile></Esri><toolbox name="SymbolsFilter" alias="Geocover"><arcToolboxHelpPath>c:\program files\arcgis\pro\Resources\Help\gp</arcToolboxHelpPath><toolsets/></toolbox><dataIdInfo><idCitation><resTitle>SymbolsFilter</resTitle></idCitation><idPurp>Cleaning up symbols without any features in a given extent</idPurp><searchKeys><keyword>symbols</keyword><keyword>rules</keyword></searchKeys></dataIdInfo><distInfo><distributor><distorFormat><formatName>ArcToolbox Toolbox</formatName></distorFormat></distributor></distInfo><mdHrLv><ScopeCd value="005"></ScopeCd></mdHrLv><mdDateSt Sync="TRUE">20240626</mdDateSt></metadata>
<metadata xml:lang="en"><Esri><CreaDate>20240625</CreaDate><CreaTime>10371500</CreaTime><ArcGISFormat>1.0</ArcGISFormat><SyncOnce>TRUE</SyncOnce><ModDate>20240701</ModDate><ModTime>135557</ModTime><scaleRange><minScale>150000000</minScale><maxScale>5000</maxScale></scaleRange><ArcGISProfile>ItemDescription</ArcGISProfile></Esri><toolbox name="SymbolsFilter" alias="Geocover"><arcToolboxHelpPath>c:\program files\arcgis\pro\Resources\Help\gp</arcToolboxHelpPath><toolsets/></toolbox><dataIdInfo><idCitation><resTitle>SymbolsFilter</resTitle></idCitation><idPurp>Cleaning up symbols without any features in a given extent</idPurp><searchKeys><keyword>symbols</keyword><keyword>rules</keyword></searchKeys></dataIdInfo><distInfo><distributor><distorFormat><formatName>ArcToolbox Toolbox</formatName></distorFormat></distributor></distInfo><mdHrLv><ScopeCd value="005"></ScopeCd></mdHrLv><mdDateSt Sync="TRUE">20240626</mdDateSt></metadata>
Loading

0 comments on commit 22cf03b

Please sign in to comment.