How to look up weather by latitude and longitude

The Weather API and Weather Data Services page allows the user to request weather data by a location value. The location value includes the ability to specify latitude and longitude value. This will allow the weather data to be found for any point in the world whether it’s a city with an address or a point in the middle of the ocean. The location value can also be an address or partial address value, a US zip code or weather station ID.

What is latitude and longitude?

Latitude and longitude are used to locate points on the globe as a pair of numbers. Latitude represents how far north/south the point is and longitude represents how far east/east the point is.

The numbers are often expressed in degrees because the earth is approximately a sphere. Because we can travel all around the world we use 360 degrees of longitude for a full circle and 180 degrees of latitude for the half circle of north-south.

We don’t generally use 0-360 degrees for longitude and 0-180 degrees for latitude however. We use -180 to 180 degrees longitude and -90 to 90 degrees latitude.

Latitude and Longitude diagram
(Source: Wikipedia)

0 degrees longitude passes through the ‘prime meridian’ of Greenwich, in London, England. Points west of this are negative longitude (eg North and South America) , points east are positive (eg Europe, Asia and Australasia). 0 degrees latitude is the equator with positive numbers representing the northern hemisphere and negative the southern hemisphere.

See https://en.wikipedia.org/wiki/Geographic_coordinate_system for more of the technical details.

How to enter a latitude and longitude to retrieve weather data

Visual Crossing Weather requires that you format your latitude and longitude values in the form [decimal latitude],[decimal longitude]. For example 40.7128,-74.0060 is the location of New York City, USA. Where the latitude is 40.7128 (positive indicating that it is in the northern hemisphere) and the longitude is -74.0060 (negative indicating that it is located west of the prime meridian (ie London or Paris).

Here is a URL that requests historical weather data for this location using our free historical weather data dashboard.

https://www.visualcrossing.com/weather-history/40.7128%2C-74.0060/us/2021-06-01/2021-06-16

We can zoom out on the map in the dashboard and see that our latitude and longitude value correctly places us in New York City on the east coast of the USA:

You can also use the Weather API to request the information by latitude and longitude:

https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/40.7128,-74.0060?unitGroup=us&key=YOUR_API_KEY

Converting from other forms of latitude and longitude

There are other ways to write the longitude and latitude. For example rather that writing values as negative or positive, you can use the points of the compass to indicate the hemisphere:

 40.7128° N, 74.0060° W

In this notation, the ‘N’ indicates the northern hemisphere and the ‘W’ indicates the western. To convert it to the decimal format the weather data look up requires, remove the degree sign and compass letter. If the latitude is in the southern hemisphere (S), then set the latitude negative. If the longitude is in the western hemisphere (W) then set the longitude negative.

Another format is the degrees, minutes and seconds notation. For example our New York City location could be written as:

40° 42' 46",-74° 0' 21"

Degrees, minutes and seconds breaks down angles a little bit like the hands of the clock into hours, minutes and seconds (hence the name). To show these values in many tools such as Visual Crossing Weather we are required to convert from DMS notation to decimal degrees using the formula:

Decimal Degrees=degrees+minutes/60+seconds/3600

You can also use an online converter to help with the conversion.

Questions or need help?

If you have a question or need help, please post on our actively monitored forum for the fastest replies. You can also contact us via our support site or drop us an email at support@visualcrossing.com.