latitude-longitude

Country code from a latitude longitude position (without using geocoding services)

五迷三道 提交于 2019-11-30 05:30:18
问题 How can i get the country code from a latitude longitude position? I know that there are many geocoding services available, but they don't meed my requirement because my application gets blocked a few hours after it goes live (many geocoding requests). Most geocoding services also offer commercial services, but they are not yet a option because the project is in it starting blocks. I did a bit of research and think i found a way to do it: Get a shape file (or other data file) that contains

How can I get latitude, longitude from x, y on a Mercator map (JPEG)?

不羁岁月 提交于 2019-11-30 05:17:28
I have a Mercator projection map as a JPEG and I would like to know how to relate a given x, y coordinate to its latitude and longitude. I've looked at the Gudermannian function but I honestly don't understand how to take that function and apply it. Namely, what input is it expecting? The implementation I found (JavaScript) seems to take a range between -PI and PI, but what's the correlation between my y-value in pixels and that range? Also, I found this function which takes a latitude and returns the tile for Google Maps, which also uses Mercator. It would seem that if I knew how to inverse

Calculating the distance between 2 points in c#

此生再无相见时 提交于 2019-11-30 05:17:23
问题 I am trying to sort out a method to calculate the distance between 2 points in c#. This is the code I have been trying though I fear the answer I get is not correct. static void Main() { //postcode australia 2600 -> 3000 float latA = -31.997976f; float longA = 115.762877f; float latB = -31.99212f; float longB = 115.763228f; decimal distance = (DistanceBetween(latA, latB, longA, longB)); Console.WriteLine("Distance is" + distance); Console.ReadLine(); } static decimal DistanceBetween(float

Format latitude and longitude axis labels in ggplot

隐身守侯 提交于 2019-11-30 05:14:18
I have a ggplot map, for example: library(ggmap) ggmap(get_map()) I'd like the axis labels to be automatically labeled as N-S / W-E: in the above case, for example, instead of lon -95.4 it should show 95.4°E. I have tried to mess with the scales package and using scale_x_continuous and scale_y_continuous labels and breaks options, but I have not managed to make it work. It would be awesome to have a scale_y_latitude and scale_x_longitude . EDIT: Thanks to @Jaap 's answer I got to the following: scale_x_longitude <- function(xmin=-180, xmax=180, step=1, ...) { ewbrks <- seq(xmin,xmax,step)

Get PHP Timezone Name from Latitude and Longitude? [duplicate]

时间秒杀一切 提交于 2019-11-30 03:45:56
This question already has an answer here: How to get a time zone from a location using latitude and longitude coordinates? 14 answers Is there a way get the timezone of a user by their latitude and longitude? And not just the offset, but the actual timezone they're in. Essentially, I'm searching for the polar opposite of DateTimeZone::getLocation which returns the latitude and longitude for a certain timezone. Geonames should do the job nicely: http://www.geonames.org/ They've also got a php library. For those who wants to get timezone from country code, latitude and longitude . ( easy to get

How to get E6 format of Longitude Latitude for Google Maps on Android

末鹿安然 提交于 2019-11-30 03:38:56
how do i find out the SPECIFIC E6 values of longitude latitude of a location. For example, i googled for long-lat of Asuncion, the capital city of Paraguay. It returns me: The latitude and longitude of Asuncion, Paraguay is 25°16' S, 57°40 W Now how do i convert THIS format of long-lat into E6 format of long-lat which android understands? What exactly IS THIS E6 thing? [p.s. i also googled for E6 long-lat of Asuncion....... with no luck] Rakib So it's a two step process - thanks to hooked82 's answer step 1. Conversion from DMS to Decimal Degrees From Wikipedia Given a DMS (Degrees, Minutes,

Geocoder.getFromLocation grpc failed on Android real device

南楼画角 提交于 2019-11-30 03:23:51
问题 I need to get the city and state from latitude and longitude. Geocoder does this function to get the city and state. But I am getting an error java.io.IOException: grpc failed in below line only on Android real device . It is working fine in emulators . new Geocoder(context).getFromLocation(latLng.latitude, latLng.longitude, 1).get(0); Also I have been calling this function using Asynctask which is suggested in another post Geocoder grpc failed in stack overflow but nothing works for me. And

get Lat Lang from a place_id returned by autocomplete place api

让人想犯罪 __ 提交于 2019-11-30 03:07:43
I am searching the place in my apps using the google autocomplete place api and now I want to get latitude and longitude of the place that i have searched. How to get latitude and longitude from the result returned by autocomplete place api by google in android? droidmad The following code snippet which uses Google Places API for android worked for me Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId) .setResultCallback(new ResultCallback<PlaceBuffer>() { @Override public void onResult(PlaceBuffer places) { if (places.getStatus().isSuccess()) { final Place myPlace = places.get(0);

How can I determine the distance between two sets of latitude/longitude coordinates?

十年热恋 提交于 2019-11-30 02:56:18
问题 I am trying to write something that will determine the distance between to sets of lat/lon coordinates. I am using the following code which I found on this site: public static double distance (double lat1, double lon1, double lat2, double lon2) { double lat1 = Convert.ToDouble(latitude); double lon1 = Convert.ToDouble(longitude); double lat2 = Convert.ToDouble(destlat); double lon2 = Convert.ToDouble(destlon); double theta = toRadians(lon1-lon2); lat1 = toRadians(lat1); lon1 = toRadians(lon1)

Conversion of lat/lng coordinates to pixels on a given map (with JavaScript)

拥有回忆 提交于 2019-11-30 02:31:58
I have put together a cities database from MaxMind and it includes the lat/lng values for each city in the database. I have also put together a map of North/America and I would like to have a icon appear on the x/y coordinates of the map which are derived from the lat/lng coordinates of the city database record. From my understanding I need to find the left/top bounds of the map first (lat/lng -> x/y) and then use that as a difference for the linear relationship between any of the north american city x/y coords. Finally, depending on the size of the map, its just a few simple division and