question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NYC Taxi Example Slightly Reworked but inoperable

See original GitHub issue

Can you tell me if this is a coding problem or an issue? I seem to always have my heat map show up near NULL Island. I figured it was a projection problem, so tried to work this per the gv.Points method as well and reproject the data (like some NYC taxi examples). Have I misapplied the code or did I find a new projection issue? Thanks.

import param, parambokeh
from colorcet import cm_n
from holoviews.streams import RangeXY
from bokeh.tile_providers import STAMEN_TONER

#url='https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{Z}/{X}/{Y}.jpg'
#url='https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}.png'
#url='http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png'
url=STAMEN_TONER
tiles = gv.WMTS(url,crs=crs.GOOGLE_MERCATOR)
opts = dict(width=1000,height=600,xaxis=None,yaxis=None,bgcolor='black',show_grid=False)

class AirTraffic(hv.streams.Stream):
    alpha      = param.Magnitude(default=0.75, doc="Alpha value for the map opacity")
    colormap   = param.ObjectSelector(default=cm_n["fire"], objects=cm_n.values())

    def make_view(self, x_range, y_range, **kwargs):
        map_tiles = tiles.options(alpha=self.alpha, **opts)
        points = hv.Points(ddf, ['lon', 'lat'])
        taxi_trips = datashade(points, cmap=self.colormap,
                               dynamic=False, x_range=x_range, y_range=y_range, width=1000, height=600)
        return map_tiles * taxi_trips

explorer = AirTraffic(name="Russell Traffic")
parambokeh.Widgets(explorer, callback=explorer.event)
hv.DynamicMap(explorer.make_view, streams=[explorer, RangeXY()])

Thanks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
philippjfrcommented, Jun 9, 2018

I noticed that the app update cycle takes quite some time (~700k rows) as I never was able to see it update (even after several minutes) with the map tile added into the widget. I was using a 8vCPUs 16GB RAM GCP Ubuntu machine.

I would suggest projecting the points ahead of time, with:

points = gv.Points(ddf, ['lon', 'lat'])
projected_points = gv.project(points)

and then datashade that.

1reaction
jbednarcommented, Jun 9, 2018

Hi Tyler! Based on your plot above, datashader does seem like what your data deserves; just about any other way of showing that data will obscure all the detail that you can see there.

Ordinarily, the tiles shouldn’t affect the display speed measurably. But the tiles only support one projection (Web Mercator), and so if you overlay on tiles then your points have to be reprojected (expensively) before datashader can do its aggregations, every time you compute a plot. So for interactive use you should probably project your points all at once, making subsequent datashading on a tile background much quicker. @philippjfr can probably suggest a more convenient way, but what I use for reprojecting is the simple lnglat_to_meters() function in datashader.util.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Taxi Complaint · NYC311 - NYC.gov
Route complaints; Being discourteous or rude; Not displaying a license, or displaying someone else's license; A dirty condition or bad odor in the...
Read more >
Analyzing 1.1 Billion NYC Taxi and Uber Trips, with a ...
The New York City Taxi & Limousine Commission has released a staggeringly detailed historical dataset covering over 1.1 billion individual ...
Read more >
Grand Theft Auto III - Wikipedia
Set within the fictional Liberty City (loosely based on New York City), the story follows Claude, a silent protagonist who, after being betrayed...
Read more >
New York taxi details can be extracted from anonymised data ...
FoI request reveals data on 173m individual trips in US city - but could yield more details, such as drivers' addresses and income....
Read more >
Alleged Nintendo gigaleak reveals eye opening prototypes for ...
There's also this slightly broken Super Mario Kart build with no ... Manage cookie settings No idea but source code is personal -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found