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.

  • For those looking at this later: In this specific instance, the args {"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"%7D that did the trick.
    – Tubbs
    Commented Mar 15, 2023 at 13:31

1 Answer 1


To filter the layer you would have to add layerDefs, which you already correctly identified.

The correct parameter looks like this: &layerDefs={"1":"prod_type='Freeze Warning'"}

Appending this to your testing URL you will get the following: URL

For other parameters you could use please refer to the ESRI doc here. The documentation is sometimes not very clear on what you need to provide but at least gives you some hints. Now if you want to recolor the image you could provide the dynamicLayer parameter or use the built in FeatureServer capabilities of the service to get the e.g. GeoJSON.

  • Thanks you so much! I wish I could give you more up votes. You hit the nail on the head with the docs - I always have trouble grokking the docs because they often don't cover exactly what I'm looking to do or the type of information I'm trying to get. Thanks again!
    – Tubbs
    Commented Mar 15, 2023 at 13:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.