0

I'm trying to plot some GPS data on a map tile. My code is very simple (based on this: http://pyviz.org/tutorial/A2_Dashboard_Workflow.html) :

import hvplot.pandas
from geoviews.tile_sources import EsriImagery

GPS = df.hvplot(x='LongCoord', y='LatCoord')

track_GPS * EsriImagery

This code returns the GPS data correctly proportioned and as expected. But the background image is white, but does contain a copyright notice for Esri. Earthstar Geographics.

This suggests to me I am connecting to Esri and it is working to the extent that the axis scaling is correct. But I don't see any satellite imagery.

Any ideas what could be going wrong?

Ben

BMichell
  • 3,581
  • 5
  • 23
  • 31

1 Answers1

0

If your data are in latitude and longitude coordinates, you can declare that to hvplot by passing geo=True to the hvplot() call. Then instead of a bare HoloViews object, you'll get a GeoViews object that is aware of geographic coordinate systems. Then when you overlay the data on the map tiles, GeoViews will re-project your data so that things will line up properly.

Right now, the map tiles are in Web Mercator coordinates (values like 99999999.99) and you're probably overlaying data that hasn't been projected into Web Mercator (values like 127.6), and so you're effectively zooming in to a tiny area of one pixel of the Esri data, beyond the resolution they support.

James A. Bednar
  • 3,195
  • 1
  • 9
  • 13
  • In that case, you'll need to explicitly declare what coordinate system your data is in, using `crs=` in the hvplot call. See:https://hvplot.pyviz.org/user_guide/Geographic_Data.html – James A. Bednar Apr 26 '19 at 16:00
  • Sure, you just need to tell that to GeoViews, e.g. `from cartopy import crs; df.hvplot(x='LongCoord', y='LatCoord', crs=crs.GOOGLE_MERCATOR, geo=True)`. `geo=True` should be optional with recent hvPlot versions, if you already pass `crs=`. – James A. Bednar Apr 29 '19 at 12:04