OpenStreetMap Forum

The Free Wiki World Map

You are not logged in.

#1 2012-01-20 14:11:21

How to use OpenStreetMap in Java desktop application?

Hello forum,
I'm a newbie in geocoding.
Can u help me to understand how can I use OpenStreetMap in Java desktop application?

Thanks in advnced,
palban

Offline

#2 2012-01-22 21:20:44

Re: How to use OpenStreetMap in Java desktop application?

You can go to wiki.osm.org and type "java" at its search box there.

Or have a look at http://wiki.openstreetmap.org/wiki/Category:Java

Offline

#3 2012-02-29 14:30:55

Re: How to use OpenStreetMap in Java desktop application?

I'm looking for a solution to the same problem although for different reasons.

I'm trying to display a usable map in a java desktop application but I'm struggling to work out how

Offline

#4 2012-02-29 19:22:14

Re: How to use OpenStreetMap in Java desktop application?

Please tell us where and why you get struggling. And you should give us some information about your framework application so far.

Offline

#5 2012-03-01 14:31:09

Re: How to use OpenStreetMap in Java desktop application?

I'm trying to develop a routing application for windows however I'm not sure how to load the maps in a usable format to display an image and design the route. I've built the user interface, I'm now trying to make it work.

any help or guidance would be much appreciated

Offline

#6 2012-05-21 09:08:54

Re: How to use OpenStreetMap in Java desktop application?

Guys, I also have question regarding using of OSM in java app.
We've already used OSM in our app to provide our clients images with some locations.
Previously we had next mechanism:
1) Searching for long. and lat. of object in GoogleMaps.
2) We used url of OSM to generate image that has taken Long., Lat., image format(jpeg, png, etc), width, height, scale/("http://tah.openstreetmap.org/MapOf/?lat=" + loc.getLatitude() + "&long=" + loc.getLongitude() + "&z=" + scale + "&w=" + width + "&h=" + height + "&format=png")

It was working excellent, but some months before OSM closed this URL and create new("http://tile.openstreetmap.org/" + tileNumber + ".png") that took parameters for location not in Long. and Lat. but in some tiles that are calculate using radians. After we started to adopted our solution for new service we found that formula for converting long and lat to radians isn't very accurate. But most important reason is in quality of maps(we can't specify size of tile) and problems with selecting scale.
As I understand new service was introduce to solve performance issues, but it doesn't bring us what we had previously.

So my question, could we use some java framework or even external console windows application to generate image with location from coordinates in lat. and lon.?

Offline

#7 2012-05-21 11:01:57

Re: How to use OpenStreetMap in Java desktop application?

AlexyPi - You could use JMapViewer to display the maps it's available here - http://svn.openstreetmap.org/applicatio … 011-02-19/

Create a JFrame, and instance of the JMapViewer class found in the jar file and add it to the JFrame and you get a usable map with zoom and pan functions.

It also provides methods for setting the location and zoom level using lat and long. Therefore you could have a text box which the user types the location into, geocode it using google as you've done before, and the set the position using the mentioned function.

My only question is how are you getting around the Google Maps terms of service, which states that you cannot use their features with other maps here https://developers.google.com/maps/terms in section 10.1.1.g

I wanted to do exactly what I've said above but then I found that so now I do not think it's allowed

Offline

#8 2012-05-23 15:56:02

Re: How to use OpenStreetMap in Java desktop application?

Decor58 wrote:

AlexyPi - You could use JMapViewer to display the maps it's available here - http://svn.openstreetmap.org/applicatio … 011-02-19/

Create a JFrame, and instance of the JMapViewer class found in the jar file and add it to the JFrame and you get a usable map with zoom and pan functions.
...

Thank you Decor58 for advice. I've tried and integrated JMapViewer to my app. But after working with it and taking a look on it's sources I have two quetions:
1) Sometimes the whole map isn't loaded and some tiles are missing. In console there is messages like "failed loading 3/3/3 Connection timed out: connect". Is this possible to increase this timeout?
2) Do you know a way to check if the whole map with all tiles is completely loaded? I tried to override a couple of methods but it didn't help. I need this info to convert JMapViewer to image and save it in system.

Offline

#9 2012-05-23 16:45:05

Re: How to use OpenStreetMap in Java desktop application?

I'm afraid I've not played around with the map that much so I cannot help, sorry

Offline

Board footer

Powered by FluxBB 1.4.8
Hosting sponsored by Oxilion