0

I have a geoviews data set that I finally got to work somewhat. It is a set of Lats, Lons, and velocities of GPS stations, with interpolations between them. The values are on a regular grid.

I followed the example at https://geoviews.org/user_guide/Gridded_Datasets_II.html to create an ensemble as follows

dataset = gv.Dataset(df, kdims=['Lon', 'Lat'], vdims ='Z')
ensemble = dataset.to.heatmap( ['Lon', 'Lat'], vdims = 'Z')

When I call ensemble, I get a heatmap with the correct lat and lon values as shown belowensemble call Note the lats and lons are correct here. Now I will run again with line shown above that was commented out. Here is the output enter image description here

I have tried this with different tile sources , hoping that would fix it. I also tried overlaying geoviews features such as coastlines (gf.coastline()) and when I run that I get an error TypeError: range() got an unexpected keyword argument 'dimension_range'

I really want to love this package, it seems like such a powerful package but I am having a hard time getting things to work. I will also take suggestions for other packages that have the ability to create a heatmap, and display a basemap under it. Preferably with inbuilt zoom functionality.

Thanks

Nwpulver
  • 45
  • 5
  • I would also like to not, I have tried this using hvplot and setting geo=True, but for some unknown reason, that does not work – Nwpulver Jun 10 '20 at 15:38
  • It says geo option cannot be used with kind='scatter'. I am using scatter because nothing else will work with pandas dataframes I guess? – Nwpulver Jun 10 '20 at 15:52

1 Answers1

1

The problem here is that HeatMap is not a GeoViews element so it has no idea what to do in a geographic context. If instead you use an gv.Image or gv.QuadMesh (depending on your data), GeoViews will automatically assume your data is in latitudes and longitudes and project it to the Mercator coordinate system used by the tile sources. So I'd suggest changing it like this:

ensemble = dataset.to(gv.Image, ['Lon', 'Lat'], vdims='Z')
philippjfr
  • 3,997
  • 14
  • 15
  • When I run that I get the error "DataError: Image type expects gridded data, PandasInterface is columnar.To display columnar data as gridded use the HeatMap element or aggregate the data." If I try QuadMesh I get another error "DataError: None of the available storage backends were able to support the supplied data format." Which is why I was using the heatmap function, because it was the only one that would work for me. – Nwpulver Jun 10 '20 at 15:08
  • This message indicates a mismatch between your data and what you are trying to do with it. If it's gridded data already, Pandas is an odd choice; Pandas handles arbitrary data points, which if they fall directly on a regular grid should be represented as such using a gridded data structure like xarray or Numpy. If they are not gridded already, you'll need to aggregate them into a regular grid, which you can do with e.g. `from holoviews.operation.datashader import rasterize ; rasterize(dataset.to(gv.Points, ['Lon', 'Lat'], vdims='Z'))`. It's hard to tell without your actual data, though. – James A. Bednar Jun 10 '20 at 22:24