how to get latitude and longitude of my current location using JAVA - geolocation

I want to get latitude and longitude using Java. I need some JAVA API , which can be used to get current latitude and longitude. There is option in Google Geo-location API in which we can get latitude and longitude by setting location name , but i need current location without knowing the name of location.

If you're writing a program that doesn't connect to the internet this is impossible from what you describe.
If you do, however, there are some location via IP options available.
http://skyhookwireless.com/location-technology/ is one.

Related

Can we run IP based testing for geo location in playwright?

Playwright provides geolocation support using latitude and longitude, however it only changes location at client. In my use-case, I need IP address needs along with APIs and urls so fetch and render content based on IP address
Playwright geolocation support is about emulating the geographic location of the client, as diplayed below:
const context = await browser.newContext({
geolocation: { longitude: 52.3456, latitude: 5.6789},
permissions: ['geolocation']
});
It is not possible to change the geolocation of the server, since you don't have control over the server. The only thing you can do is mock the server response, but that way you're not testing the actual server behavior, which seems to be what you want.

Service which will return client timezone on http request

I would like to set automatically timezone on my Arduino with ethernet card. So I'd like to know if there is the service which can return client timezone on http request.
Since you have nothing but the IP address, then the only possibility is to guess at the location via IP geolocation. For example, you could use ipinfo.io, or freegeoip.net, or any number of other sources. (A Google search for "IP Geolocation" will show many results).
Of course, IP Geolocation isn't all that accurate, and you may have many incorrect results. If your device has GPS or some other source of location data, that would be much more accurate than IP Geolocation.
Once you have a latitude and longitude, you can call one of the API's listed here to return the time zone.

Database geolocation which one is better

I am looking into getting a geolocation database. I am trying to understand the difference between a paid and a free service besides how accurate the results are.
I want to display data on the page based on the user's location. Should I user server side or client side to check the location and display the data accordingly? I can imagine how to do it server side, but not client side.
If I want to get the user's ip, country, region, city, and show the cities within x km around that city, I would also need the Latitude and Longitude correct?
I was looking at
http://freegeoip.net/
and
http://www.ip2location.com/databases#comparison
option: DB5
I suggest maxmind database for Geo location, I have used maxmind database for my
website
the link of maxmind data base is-http://maxmind.com/geoip/legacy/geolite/
freegeoip uses maxmind GeoLite2 database. You could as well download it yourself (~25mb) and lookup on your server which would be faster.

Geolocation - How Does it Work?

I am using a script bought from Code Canyon (a weather script) and the script uses MaxMind GeoIP Javascript Web Service to determine my users current location. The question I have is how does MaxMind (or other geolocation services) determine the location?
When it determines my location it is on average about 30 miles away from my actual city. Why and how does it determine the location being there and not closer? I assume this has to do with my ISP and my ISP routing. Is this correct?
The location it is showing you is the location of your internet server.
If you are using the geolocation code which uses your ip address to get the current location then it will show the location of your host server.
Your ISP assigns you an IP when connecting. Obviously, the ISP bought that IP at one point, and the geolocation service you are using has an entry for it, in this case, a data center of your ISP.

Error accessing NOAA site using lat/long

I'm trying to retrieve weather data by latitude and longitude. I've reviewed the API on the NOAA website and I believe I'm creating my URL as indicated. However I get an error every time I try to look by lat/long. I can retrieve based on zip code, but I need to use lat/long as there are foreign locations I need data for as well.
Here is the URL I am trying to access:
http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locationsearch?latitude=35.59528&longitude=-82.55667token=XuynqsXFIGjQEXIshdoyFizBgrdZdwXO
Here is the API from their website, specific to the lat/long search:
http://www.ncdc.noaa.gov/cdo-web/webservices/cdows_locationsearch
and I get this error:
<cdoError>
<name>Internal Error</name>
<message>CDO Web Services error</message>
</cdoError>
Does anyone have a suggestion? Am I creating the URL incorrectly?
You are missing an & before token:
http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locationsearch?latitude=35.59528&longitude=-82.55667&token=XuynqsXFIGjQEXIshdoyFizBgrdZdwXO

Resources