Howto real time rendering with Java

From OpenStreetMap Wiki
Jump to: navigation, search

To render the map in real time using java there are multiple existing applications and libraries you may look at:

traveling salesman

For multiple implementations of rendering osm-data to a Java Graphics2D-object, look at the IPaintVisitor-interface in Traveling-Salesman's LibOSM.

There are currently 4 rendering engines to choose from:

  • ODRPaintVisitor - paints very nice maps
  • SimplePaintVisitor - is trivial and easy to understand
  • TilePaintVisitor - downloads and caches tile-images from the network
  • SmoothTilePainter - same but downloads asynchronously

To render you can optain a MemoryDataSet from a FileLoader like in the following example.


To look at how josm paints the map for editing, you may look at the OsmDataLayer-class that uses the SimplePaintvisitor-class.