Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map Legend - not showing point symbols for graduated classification #51

Open
smalers opened this issue Jul 5, 2022 · 2 comments
Open
Assignees
Labels
bug Something isn't working critical Priority: highest priority XS Size: 2 hours or less

Comments

@smalers
Copy link
Contributor

smalers commented Jul 5, 2022

I have been cleaning up the Poudre Basin Information Current Conditions / Environment Flood map. I initially defined a graduated classification symbol for the precipitation stations, as follows:

# Graduated classification table for FWS precip
# - general values are used to give an indication of concern
# - refer to the FWS for more detailed displays
#
# The value from attribute is compared as follows to determine symbol:
#  value > valueMin
#  value <= valueMax
valueMin,valueMax,color,opacity,fillColor,fillOpacity,weight,colorName,label
-Infinity,<.1,#008a36,0.0,#008a36,1.0,1,green,< .1 inch of precipitation in the last day
>=.1,<.25,#f5b831,0.0,#f5b831,1.0,1,yellow,
>=.25,<.5,#ee8818,0.0,#ee8818,1.0,1,orange,
>=.5,<1,#b63d91,0.0,#b63d91,1.0,1,magenta,
>=1,Infinity,#d12619,0.0,#d12619,1.0,1,red,
# Use black for NoData
NoData,NoData,#000000,0.0,#000000,1.0,1,black,No data

I accidentally included an extra 3 digit at the start of the magenta (#3b63d91). This caused the color for that line to be shown as black. Need to warn to the console and/or truncate the color string to the number of characters that can be parsed. Also, the legend is not drawing, even though the map is OK. See the image below.

And, while I was troubleshooting, I tried different combinations of operators and some did not seem to work, for example using > on the left and no operator on the right. Maybe it was working OK but looked broken due to the other issue.

image

Also, the symbolSize property does not seem to have an effect.
After some experimentation, I was able to get the symbol size to be recognized but I could not get the legend to display. It seems that the behavior should be the following:

  1. Allow the symbolShape, symbolSize and other properties to be specified in the map configuration file, which will be used as defaults.
  2. Allow the symbolShape, symbolSize and other properties to be specified in the classification file, to vary based on the data value.

What I ended up with is the following command in GeoProcessor:

SetGeoLayerViewGraduatedSymbol(GeoLayerViewID="FloodWarningPrecipStationsLayerView",Name="Colorize daily precipitation",Description="Color daily precipitation.",ClassificationAttribute="Precip.1Day",Properties="symbolShape:Circle,symbolSize:4,sizeUnits:pixels,classificationFile:layers/fws-precip-stations-classify.csv")

The resulting map configuration file is:

              "geoLayerSymbol": {
                "name": "Colorize daily precipitation",
                "description": "Color daily precipitation.",
                "classificationType": "Graduated",
                "classificationAttribute": "Precip.1Day",
                "properties": {
                  "symbolShape": "Circle",
                  "symbolSize": "4",
                  "sizeUnits": "pixels",
                  "classificationFile": "layers/fws-precip-stations-classify.csv"
                }
              },

The classification file is as follows. if I added symbolShape to the file, the layer was not drawn but there is not error in the console.

# Graduated classification table for FWS precip
# - general values are used to give an indication of concern
# - refer to the FWS for more detailed displays
#
# The value from attribute is compared as follows to determine symbol:
#  value > valueMin
#  value <= valueMax
valueMin,valueMax,color,opacity,fillColor,fillOpacity,weight,colorName,label,symbolSize,sizeUnits
-Infinity,<.1,#008a36,0.0,#008a36,1.0,1,green,< .1 inch of precipitation in the last day,4,pixels
>=.1,<.25,#f5b831,0.0,#f5b831,1.0,1,yellow,,4,pixels
>=.25,<.5,#ee8818,0.0,#ee8818,1.0,1,orange,,4,pixels
>=.5,<1,#b63d91,0.0,#b63d91,1.0,1,magenta,,4,pixels
>=1,Infinity,#d12619,0.0,#d12619,1.0,1,red,,4,pixels
# Use black for NoData
NoData,NoData,#000000,0.0,#000000,1.0,1,black,No data,4,pixels

And the result is the following, with the symbol still not drawn from graduated classification.

image

@smalers smalers added bug Something isn't working critical Priority: highest priority XS Size: 2 hours or less labels Jul 5, 2022
@Nightsphere
Copy link
Collaborator

I fixed the legend shape not showing up, so that shouldn't be an issue anymore.

The symbolSize and symbolShape properties will be a bit more involved. Right now, the way a graduated layer on the map is created uses map config file properties, and overrides if any of the same properties are given in a classification file. I believe this is the desired behavior, so I won't do anything further with that.

The issue is how the legend decides what symbols to draw. Right now, I'm checking each map config's geoLayerSymbol directly in the legend component's HTML file using an *ngIf directive. This needs to be updated so that the conditional performs multiple checks in a function:

  • If a classification file is given and contains the symbolSize and/or symbolShape properties use those, or
  • If no classification file is present, use the geoLayerSymbol's defaults.

I was using hard-coded defaults for the size and shape in the code, so I will need to change it so that these new defaults are used instead. I'll just need to check with Steve to make sure the size and shape geoLayerSymbol properties will always be present in a map config file, and then I can remove the hard coded defaults.

It might have been resolved with the legend shape fix, but I had no issues adding the size and shape to the classification file and having it update on the map. The only issue was if the classification file used Square for the shape, and the map config file had Circle, the legend would show circles, and the map would show Squares.

Screen Shot 2022-07-18 at 8 47 41 PM

This is just an example of the issue I brought up above with the legend code only checking the map configuration file.

@smalers
Copy link
Contributor Author

smalers commented Jul 19, 2022

I am confused by these comments. Is it totally fixed or not? Will it be fixed soon? I think it should work as follows:

  1. The classification file is defined with ranges and corresponding symbol information. Perhaps the properties for the symbol can provide defaults to use should the classification file have errors or range gaps. Basically, the value for a feature is checked against the ranges and once a match is found, the symbology is used.
  2. The classification file is used to define markers on the map.
  3. The classification file is used to draw the legend. The legend should look very similar to the symbols drawn on the map, including the size of markers.

Please let me know when it is pushed so I can use and let me know if we need to discuss things that are difficult or can't be done. The best situation is for implementers to know that all the features work as intended for points, lines, polygons, etc. and not to come across limitations as the software is used.

Nightsphere added a commit that referenced this issue Jul 21, 2022
…mation is displayed in the sidebar. See Changelog for all updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working critical Priority: highest priority XS Size: 2 hours or less
Projects
None yet
Development

No branches or pull requests

2 participants