0

I want to make a desktop application using java that will display a map and allow routing features. Essentially a desktop version of http://www.yournavigation.org, I started with the easy bit of creating the user interface but I'm now lost as to how I can render an image from the .osm files

Can anyone point me in the right direction?

asked 29 Feb '12, 12:19

Decor58's gravatar image

Decor58
11112
accept rate: 0%

Thank you for all the ideas for a solution, I will let you know how I get on.

Cheers Rob

(01 Mar '12, 12:28) Decor58

Hey guys, I've been looking at the JXMapViewer

I've found a guide here http://today.java.net/pub/a/today/2007/10/30/building-maps-into-swing-app-with-jxmapviewer.html

Although the download link in the guide doesn't work, I've found another download location for the JMapViewer.jar file

According to the guide I believe I should be able to drag and drop the JMapViewer.class into a swing application however I cannot seem to get this to work.

I figured another way to do this would be to create an instance of the JMapViewer.class and add it to a JPannel however I'm not sure where to put the code for the constructor of the class or how to add it to the pannel.

Any help or guidance would be much appreciated,

P.S. I'm using netbeans to create this app

(07 Mar '12, 13:54) Decor58

I've managed to get JMapViewer working although not embedded in my app yet, now need to work out how to use it to make my routing app!

(07 Mar '12, 19:01) Decor58

3 Answers:
1

Check this wiki page out : http://wiki.openstreetmap.org/wiki/Rendering

Perhaps Mapsforge, although designed for Android, is a java toolbox providing tools and api's, including for rendering which can be a start point for you. (You could also create the tiles with an external application and just read them from the disk into your desktop app).

permanent link

answered 29 Feb '12, 12:30

Pieren's gravatar image

Pieren
9.7k2075157
accept rate: 15%

1

You mention "render an image from .osm files". We should probably make sure you're aware that is maybe over-complicating things. It depends on the kind of interface you want, but you might be better off taking a look at something like JMapViewer which is a "slippy map" component embeddable within java projects, which works by bringing in tiles into your application from tile server, a lot like a conventional web map display. The tile server could be OpenStreetMap's, or alternatives

However having said all that...

If you do create an application which "renders an image from .osm files" this is better in many ways. It could be the best way to make a super-fluid mapping application harnessing the power of OpenStreetMap's raw data. It is however, a more technical undertaking. Mapsforge (in java) is quite new, but promises to make this easier in a pre-packaged embeddable way, so this may be the closes thing to what you're asking for here.

If you didn't already, have a play with JOSM. With a small area of map data loaded in, you can zoom and pan around very fluidly. Try doing this with different Style settings configured in preferences. That's all written in java, and supports MapCSS stylesheets. It may be possible to rip out the rendering logic from the rest of the editor application. But if you're delving into other codebases, there's lots of other java projects which do vector rendering, particularly for mobile e.g. GPSMid and Navit

permanent link

answered 29 Feb '12, 15:41

Harry%20Wood's gravatar image

Harry Wood
9.3k2486126
accept rate: 13%

0

The library used to create the main map on openstreetmap.org, Mapnik, is open source and available as Windows binaries. This would allow you to have an identical map style to OpenStreetMap, but only have to download and process a minimal amount of data.

permanent link

answered 29 Feb '12, 14:47

Jonathan%20Bennett's gravatar image

Jonathan Ben...
8.2k1785108
accept rate: 18%

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×263
×66
×30
×23
×9

question asked: 29 Feb '12, 12:19

question was seen: 12,917 times

last updated: 08 Mar '12, 14:13

powered by OSQA