OSMViz

Retrieve and use OpenStreetMap images
Download

OSMViz Ranking & Summary

Advertisement

  • Rating:
  • License:
  • MIT/X Consortium Lic...
  • Price:
  • FREE
  • Publisher Name:
  • Colin Bick
  • Publisher web site:
  • http://cbick.github.com

OSMViz Tags


OSMViz Description

Retrieve and use OpenStreetMap images OSMViz is a small set of Python tools for retrieving and using OpenStreetMap (OSM) images (actually, Mapnik images served by Slippy Map). OSMViz's original purpose was to draw a bunch of things moving around on the map, which has been somewhat generalized and expanded.With OSMViz you can: * Grab appropriate rendered OSM tiles from an OSM server of your choosing * Patch tiles together into a bigger map * Easily animate stuff on that map (requires pygame)A note about OpenStreetMap mapsIf you choose to pull tiles from the openstreetmap.org server, then there are some things you should know: * These tiles have a usage policy, available here. * These tiles are (c) OpenStreetMap and contributors, CC-BY-SA Using OSM VizThe code below will show a train running across the USA. Choo choo!from osmviz.animation import TrackingViz, Simulationstart_lat,start_lon = (45.77,-68.65) # Northeastend_lat,end_lon = (30.05,-118.25) # Southwestbegin_time, end_time = 0, 60 # In 60 seconds!def locAtTime(t): # Basic interpolator if t < 0: return start_lat,start_lon if t > 60: return end_lat,end_lon frac = t/60.0 interp_lat = start_lat + frac * (end_lat-start_lat) interp_lon = start_lon + frac * (end_lon-start_lon) return interp_lat,interp_lonimage_f = "images/train.png" zoom = 6 # OSM zoom levelviz = TrackingViz("Continental Espresso", image_f, locAtTime, (begin_time,end_time), (30,46,-119,-68.5), # lat/lon bounding box 1)sim = Simulation(,[],0)sim.run(speed=1,refresh_rate=0.1,osmzoom=zoom)While the animation is running, you can control it as follows:* Mousing over the icon displays its label ("Continental Espresso")* Up/down arrows increase/decrease the speed of simulation (can go backwards in time)* Left/right arrows set simulation to begin/end of the time window* Space bar sets the speed to zero* Escape key exits. To run it yourself you need to have an existing "images/train.png" as well as an empty "maptiles/" directory. These already exist in the "test" directory in the source download; in fact one of the included tests is to show the same train. Requirements: · Python · pygame · PIL · OpenStreetMap


OSMViz Related Software