Skip to content

Commit

Permalink
Fix Excel encoding (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
procrastinatio authored Jun 27, 2024
1 parent 46e4290 commit d71b363
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions SymbolsFilter.pyt
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ def save_to_files(output_path, filtered, drop_null=True, engine=None):
if drop_null:
df = df[df.Count != 0]

# TODO: why?
# TODO: why do we have to convert from cp252?
df["Rule"] = df["Rule"].str.encode("windows-1252").str.decode("utf-8")
df["Layer"] = df["Layer"].str.encode("windows-1252").str.decode("utf-8")

with pd.ExcelWriter(output_path) as writer:
if engine:
Expand Down Expand Up @@ -419,7 +420,7 @@ class SymbolFilter:

df = convert_columns(df, columns_to_convert)

# Dictionary to store counts and rows for each complex filter criterion
# Store counts and rows for each complex filter criterion
results = {}

for label, criteria in complex_filter_criteria:
Expand Down Expand Up @@ -448,14 +449,6 @@ class SymbolFilter:
)
results[label] = count

# Print the results

"""for label, result in results.items():
logger.info(f"\nFilter Label: {label}")
logger.info(f"Criteria: {result['criteria']}")
logger.info(f"Count: {result['count']}")
logger.info("Matching Rows:")
logger.info(result["rows"])"""

filtered[layername] = results
messages.addMessage(
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>211147</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>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>

0 comments on commit d71b363

Please sign in to comment.