OSM Static API with JavaFX

Sat 18 July 2009
  • 手艺 tags:
  • foss
  • GIS
  • JavaFX
  • map
  • OpenStreetMap
  • RIA
  • web published: true comments: true

OSM(http://www.osm.org) has released their first prototype of static map api. It is aimed to make web mapping easier to refer just like google has done.

All interfaces are listed in following page: http://dev.openstreetmap.org/~pafciu17/

With OSM static api, you can:

  • Show a map centered at a specified point. (using center, height and width)
  • Show a map contains specified bound box. (using bbox, zoom/height/width)
  • Create point/path/polygon in static map.
  • Choose different map render engines.
  • Control logo position in output image.
I just tested it with a simple javafx applet. For there is no crossdomain.xml on the server of OSM, to get cross-domain images, you will be asked to confirm security. Feel free to change center latitude/longitude and zoom level.

Enjoy all these free data on free applications :)

Steps to create signed javafx applet

  • javafxc OSMStaticMap.fx
  • javafxpackger javafxpackager -src . -appClass OSMStaticMap -appWidth 500 -appHeight 500
  • cd dist
  • keytool -genkey -keystore classicning.keys -alias  http://www.classicning.com/ -validity 365
  • jarsigner --keystore classicning.keys --storepass ******** OSMStaticMap.jar http://www.classicning.com/