latitude-longitude

Geographic Midpoint between two coordinates

杀马特。学长 韩版系。学妹 提交于 2019-12-18 03:40:27
问题 I have been using the Moveable-Type website to aid me in some Geocoordinate calcuations and it's been very useful, however, I have a bug in my calculation of the mid-point between two coordinates. My result is close to the expected, but not close enough: posA = {47.64570362, -122.14073746} posB = {47.64316917, -122.14032175} expected result (taken from the movable type calculator) = 47°38′40″N, 122°08′26″W = {47.644444, -122.140556} my result: {49.6054801645915, -122.14052959995759} Here is

Geographic Midpoint between two coordinates

☆樱花仙子☆ 提交于 2019-12-18 03:40:03
问题 I have been using the Moveable-Type website to aid me in some Geocoordinate calcuations and it's been very useful, however, I have a bug in my calculation of the mid-point between two coordinates. My result is close to the expected, but not close enough: posA = {47.64570362, -122.14073746} posB = {47.64316917, -122.14032175} expected result (taken from the movable type calculator) = 47°38′40″N, 122°08′26″W = {47.644444, -122.140556} my result: {49.6054801645915, -122.14052959995759} Here is

KDTree for longitude/latitude

南楼画角 提交于 2019-12-18 02:48:23
问题 Are there any packages in Python that allow one to do kdtree-like operations for longitude/latitudes on the surface of a sphere? (this would need to take into account the spherical distances properly, as well as the wraparound in longitude). 回答1: A binary search tree cannot handle the wraparound of the polar representation by design. You might need to transform the coordinates to a 3D cartesian space and then apply your favorite search algorithm, e.g., kD-Tree, Octree etc. Alternatively, if

How to convert Vector Layer coordinates into Map Latitude and Longitude in Openlayers

懵懂的女人 提交于 2019-12-17 23:12:41
问题 I'm pretty confused. I have a point: x= -12669114.702301 y= 5561132.6760608 That I got from drawing a square on a vector layer with the DrawFeature controller. The numbers seem...erm...awfull large, but they seem to work, because if I later draw a square with all the same points, it's in the same position, so I figure they have to be right. The problem is when I try to convert this point to latitude and longitude. I'm using: map.getLonLatFromPixel(pointToPixel(points[0])); Where points[0] is

Great Circle Distance question

浪子不回头ぞ 提交于 2019-12-17 22:53:02
问题 I am familiar with the formula to calculate the Great Circle Distance between two points. i.e. <?php $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); $dist = acos($dist); $dist = rad2deg($dist); //convert degrees to distance depending on units desired ?> What I need though, is the reverse of this. Given a starting point, a distance, and a simple cardinal NSEW direction, to calculate the position of

Is the Haversine Formula or the Vincenty's Formula better for calculating distance?

自闭症网瘾萝莉.ら 提交于 2019-12-17 21:57:00
问题 Which is better for calculating the distance between two latitude/longitude points, The Haversine Formula or The Vincenty's Formula? Why? The distance is obviously being calculated on Earth. Does WGS84 vs GCJ02 coordinates impact the calculation or distance (The Vincenty's formula takes the WGS84 axis into consideration)? For example, in Android, the Haversine Formula is used in Google Map Utils, but the Vincenty Formula is used by the android.Location object ( Location.distanceBetween() ).

Find city name and country from latitude and longitude in Swift

不打扰是莪最后的温柔 提交于 2019-12-17 21:51:51
问题 I'm working on application in Swift3 and I have letter problem i can't find the answer for it. How can I know city name and country short names base on latitude and longitude? import UIKit import CoreLocation class ViewController: UIViewController, CLLocationManagerDelegate{ let locationManager = CLLocationManager() var latitude: Double = 0 var longitude: Double = 0 override func viewDidLoad() { super.viewDidLoad() // For use when the app is open & in the background locationManager

how to get lat and long on touch event from google map?

别等时光非礼了梦想. 提交于 2019-12-17 19:24:20
问题 Is it possible to get latitude and longitude from Google map on touch event? For example: if i touch the New York on map, it should give me the latitude and longitude of New York. 回答1: You can get the location from most of the touch events, e.g. public boolean onTouchEvent(MotionEvent event) { int X = (int)event.getX(); int Y = (int)event.getY(); GeoPoint geoPoint = mapView.getProjection().fromPixels(X, Y); } 回答2: Instead of intercepting the TouchEvent with an overlay you can set an

Android - How to get current location (latitude and longitude)?

亡梦爱人 提交于 2019-12-17 15:43:28
问题 I am using the following code to get the current location namely (latitude and longitude), but I am not getting current location (latitude and longitude). Anyone knows why? package com.ram.currentlocation; import android.app.Activity; import android.content.Context; import android.location.Location; import android.location.LocationListener; import android.location.LocationManager; import android.os.Bundle; import android.widget.Toast; public class Location_Gps extends Activity { /** Called

MySQL latitude and Longitude table setup

痞子三分冷 提交于 2019-12-17 11:52:29
问题 I want to store latitude and longitude values of places in a mysql database table. With the future in mind I will want to be able to find these places within a certain radius of a specific location. Having said that, what datatypes should I store the latitude and longitude values in? Please could you provide me with a create table script for columns like so: place_id | lat | long Is there perhaps a column I am missing in the above table that will provide me with additional information that I