0

My ultimate goal is to create geoJSON from GRIB2 format using Python in order to display it at the Leaflet-open-street map.

I have the following data extracted from GRIBs:

Multi-dimensional array of x's (lon)

[[  0.     1.25   2.5  ... 356.25 357.5  358.75]  
 ...  
 [  0.     1.25   2.5  ... 356.25 357.5  358.75]]  

Multi-dimensional array of y's (lat)

[[-90.   -90.   -90.   ... -90.   -90.   -90.  ]  
...  
[ 90.    90.    90.   ...  90.    90.    90.  ]]

Multi-dimensional array of values

[[5076. 5076. 5076. ... 5076. 5076. 5076.]  
...  
[5138. 5138. 5138. ... 5138. 5138. 5138.]]

As these arrays are related one-to-one to each other, number of elements in each is 42048.

How do I create geoJSON from them?

In order to draw it chloropleth-like in Leaflet (here is more info on chloropleth-Leaflet if needed)

If I understand correctly, array of [x, y, val] will represent a Point and to draw the chloropleth (showing in colors values on the map) map I guess I need Polygons.

  • 1
    Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. – PolyGeo Feb 16 '18 at 8:31
  • You are trying to convert a raster into a vector format, while it might be technically possible it is unlikely to be a good solution to your problem. – Ian Turton Feb 16 '18 at 9:15
  • @IanTurton, could you please advice in which direction to dig? – trthhrtz Feb 16 '18 at 9:37

Your Answer

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

Browse other questions tagged or ask your own question.