geolocation

Calculating heading of compass to a specific coordinate instead of to north

守給你的承諾、 提交于 2019-12-05 13:59:33
I can't get this algorithm right. I'm trying to make a compass that points at a certain location instead of just pointing to, let's say, north. Something is wrong. I've spent a lot of time trying to figure this out, but i just can't find it. Any ideas? - (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading{ double distanceEast = (location.longitude > 0 && otherLocation.longitude < 0) ? 180 - location.longitude + otherLocation.longitude - -180: otherLocation.longitude - location.longitude; if (distanceEast < 0) { distanceEast += 360; } double distanceWest

location (lat long) using facebook api

纵然是瞬间 提交于 2019-12-05 13:56:01
Is there a way to get the location of a user in (latitude and longitude format) using facebook api?? I am able to get the location name and other attributes but not the lat long of the place. Is there any API for the same in javascript. If you have the user's basic info, one of the fields is location "location": { "id": "104146386288393", "name": "Newton, Massachusetts" }, You can make another query using the id of the location to return JSON containing lat/lon of the city, e.g. { "id": "104146386288393", "name": "Newton, Massachusetts", "picture": "http://external.ak.fbcdn.net/safe_image.php

HTML5 Geolocation In Rails

∥☆過路亽.° 提交于 2019-12-05 13:10:29
I am trying to grab a users location via HTML5 and pass it to my rails controller. I have the JavaScript below which calls .value on the element and sets it equal to the respective position. I would then like to submit these values through a hidden form field and pass it to my location controller so I can populate locations based on the users position. I know this has been done before and I have seen a few posts on it, but I have not had success. navigator.geolocation.getCurrentPosition(GeoL); function GeoL(position) { document.getElementById('lat').value = position.coords.latitude; document

mysql update geo point

霸气de小男生 提交于 2019-12-05 12:10:08
I have a MySQL table with latitude and longitude values. I want to play around with the spatial stuff in MySQL 5, just to see how it works. However, I'm having a real problem just getting the point data created from existing values. I was trying something like this, but it fails with syntax errors in every format I've tried. Can someone point out the right way to do this? UPDATE locationtable a SET geopoint = GeomFromText( POINT() a.latitude a.longitude ) WHERE 1 I've also tried other variations, including: UPDATE locationtable a SET geopoint = GeomFromText( 'POINT()' a.latitude a.longitude )

Parsing latitude and longitude with Ruby

流过昼夜 提交于 2019-12-05 12:04:54
I need to parse some user submitted strings containing latitudes and longitudes, under Ruby. The result should be given in a double Example: 08º 04' 49'' 09º 13' 12'' Result: 8.080278 9.22 I've looked to both Geokit and GeoRuby but haven't found a solution. Any hint? "08° 04' 49'' 09° 13' 12''".gsub(/(\d+)° (\d+)' (\d+)''/) do $1.to_f + $2.to_f/60 + $3.to_f/3600 end #=> "8.08027777777778 9.22" Edit: or to get the result as an array of floats: "08° 04' 49'' 09° 13' 12''".scan(/(\d+)° (\d+)' (\d+)''/).map do |d,m,s| d.to_f + m.to_f/60 + s.to_f/3600 end #=> [8.08027777777778, 9.22] How about

LocationManager requestLocationUpdates doesn't work

雨燕双飞 提交于 2019-12-05 11:07:55
I'm trying to get the current location in android using LocationManager and LocationListener as described at http://developer.android.com/guide/topics/location/obtaining-user-location.html However, onLocationChanged method of the LocationListener is never called. I've used a real android phone / also used the emulator and simulated location changed using telnet, as described in the link above. Here's my code: public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); /* Use the

React-native android ignores navigator.geolocation.getCurrentPosition

☆樱花仙子☆ 提交于 2019-12-05 10:46:32
问题 I'm trying to use navigator.geolocation.getCurrentPosition on my Android device (Philips Xenium). It works absolutely ok in iphone and genimotion simulator. navigator.geolocation.getCurrentPosition returns absolutely nothing - no errors, no success. However, if I turn off geolocation service in my smartphone, it returns No available location provider . Also, navigator.geolocation.watchPosition works fine. 回答1: Add the following permission to your AndroidManifest.xml file <uses-permission

How to set correct Lat and Lng based on current location

吃可爱长大的小学妹 提交于 2019-12-05 10:02:12
My goal is to do autocomplete prediction using Google Places API, and now I want to make some kind algorithm that will take current location lat and lng, and make a prediction of places only in 100-200 km diameter. So, at this moment I get user's current location lat and lng, how to set 100-200 km? private void getCurrentLocation() { mLastLocation = LocationServices.FusedLocationApi .getLastLocation(mGoogleApiClient); if (mLastLocation != null) { double latitude = mLastLocation.getLatitude(); double longitude = mLastLocation.getLongitude(); mLatLonBounds = new LatLngBounds(new LatLng(latitude

Maximum length of a decimal latitude/longitude Degree?

南笙酒味 提交于 2019-12-05 08:27:27
What is the maximum length (in kilometers or miles - but please specify) that one degree of latitude and longitude can have in the Earth surface? I'm not sure if I'm being clear enough, let me rephrase that. The Earth is not a perfect circle, as we all know, and a change of 1.0 in the latitude / longitude on the equator (or in Ecuador) can mean one distance while the same change at the poles can mean another completely different distance. I'm trying to shrink down the number of results returned by the database (in this case MySQL) so that I can calculate the distances between several points

Effective ip->location query

我怕爱的太早我们不能终老 提交于 2019-12-05 08:24:40
I have two tables: one is ip_group_city from ipinfodb.com containing ip_start numbers for determining location of IPs, and other is "visits" with information about web site visitor containing column 'ip'. I need to select top 10 region_code (from ip_group_city) by checking region_code for each IP from "visits" table. Right now I'm loading all IPs from "visits" into an array and using that IP info to query the ip_group_city by: SELECT region_code FROM ip_group_city WHERE ip_start <= INET_ATON(IP_FROM_ARR) ORDER BY ip_start DESC LIMIT 1 I'm unable to create some sort of nested query to do the