I'm currently trying to get images from a NOAA's Watches and Warnings MapServer instance, but I'm having a heck of a time trying to get only the values of interest. The data within is categorical, so it has a ton of different entries on its legends, many of which share the same color and cover each other up. It can be tough to tell if a county has a thunderstorm warning if a wind advisory is is covering it up, for example. One country could have a lime green overlay stating that there's a 'Coastal Flood Advisory' and an adjacent country could have 'Evacuation - Immediate' on it and it'd be nigh impossible to tell the difference.
The solution I want is to be able to tell it "Only produce a raster of Freeze Warnings". I can use the following url to get available watches and warnings for a region. It's nice, but I need to say "Only give me 'Freeze Warning'". It uses a UniqueValueRenderer on just one field: prod_type. That's the field that has 'Freeze Warning'. Great. Adding Query=prod_type%20like%20‘Freeze%20Warning’ to the URL made no difference in the generated output - it still showed me everything. I tried different variations of layerDefs={1:%20"prod_type%20like%20%27Freeze%20Warning%27"} and only saw errors.
Does anyone know how to do this or know of a better approach? I hope to end up being able to slap this on a leaflet map.
{"1":"prod_type='Freeze Warning'"}had to be encoded. So, on the surface and based on some of the docs, it looks like&layerDefs={"1":"prod_type='Freeze Warning'"}should work, but only it was&layerDefs=%7B"1"%3A"prod_type%3D%27Freeze+Warning%27"%7Dthat did the trick. – Tubbs Mar 15 '23 at 13:31