hi

is there any way in java programming to make a compass which shows directions if please tell me how to get the coordination of lattitude so that the needle of the compass can point to the appropriate direction with respect to these values

Recommended Answers

All 3 Replies

Can you explain what you are trying to do?
Most monitors are vertical to the plane where there would be a 360 degree view where North could be pointed to.
My monitor faces East, the right hand is to the North and the left to the South.

A GPS device can be used to get your position in Latitude and Longitude. But that would not tell you what direction North is from your position. It can be in any of 360 degrees different directions.

There are several APIs which can provide GPS functionality for triangulating the client's lattitude and longitude, but most computers do not possess the hardware necessary for determining which direction Magnetic North is in. Sorry.

Actually, it just occured to me that if the application you're coding is being deployed on a mobile device, you may be able to determine the direction of magnetic north if you were building a sattelite navigation system (or something similar), by figuring out in which direction the phone is travelling through GPS triangulation and then determining a compass position relative to that. That would require quite a complex algorithm, though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.