I have been working with the following GRIB2 files at https://mrms.ncep.noaa.gov/data/3DZdr/MergedZdr_02.00/. I need to setup a process to convert these to geoJSON polygons. I have tried official tools, GDAL, and broken old repos on GitHub that bring me nowhere.

My goal is to get a command working that inputs a GRIB2 and outputs a geoJSON, in a format close to (or reasonably close, plain-text, anything) to this format :

    "type": "Feature",
    "geometry": {      "type": "Polygon",
      "coordinates": [
          [-75.9404018832492, 42.214059843606286],
          [-75.9376138443044, 42.2149380047364],
          [-75.93727048421295, 42.21432100565146],
          [-75.94007869956438, 42.21347914637607],
          [-75.9404018832492, 42.214059843606286]
     "properties": {
        "value": -3.88768

This is all I need. I have tried gdal_translate, ogr2ogr and numerous tools (netCDF tools, python utilities) and I have come to the conclusion that this is not possible or I do not know what I am doing. If the latter is true, I would appreciate someone enlightening me. I was not expecting this to be so difficult. I would post code I have tried, but none of it is likely to make much sense in the context of my question since I have no actual working script at all yet.


1 Answer 1


As it turns out, I had used gdal_polygonize but it was giving whole numbers as output, and it appeared that it "wasn't working". In fact, there is a version of gdal_polygonize that will output floating point (https://trac.osgeo.org/gdal/attachment/ticket/4516/gdal_polygonize.py).

Also, on Windows - not using "-q" gives a traceback error which caused even more confusion. With both of these issues resolved, it now works.

The command used was :

gdal_polygonize.py filename.grib2 --float -q -f "geoJSON" out.json layer fieldname

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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