geolocation

Website that recognizes user's location/IP & changes lang. based on that

北城以北 提交于 2019-11-27 20:36:17
问题 title is pretty clear. My websites consists of both English-written and Spanish-written versions. You can go to the main site, which is in Spanish, by clicking http://www.chrishonn.com and to the translated version, which is in English, at http://en.chrishonn.com. At the index of each page there is a link (at the bottom) which allow the user to pass from one site to the other. However, I was wondering, how do big sites like Google, Yahoo!, and other brands' websites to recognize the user's

Android Geofencing (Polygon)

ⅰ亾dé卋堺 提交于 2019-11-27 20:16:53
How to create Polygon Geofence from multiple geo locations(long,lat values) . Also how to track user is entering into this geofence region or exiting from this region on android. matthewrdev A geofence is simply an array of lat/long points that form a polygon. Once you have a list of lat/long points, you can use a point-inside-polygon check to see if a location is within the polygon. This is code I have used in my own projects to perform point-in-polygon checks for very large concave polygons (20K+ vertices): public class PolygonTest { class LatLng { double Latitude; double Longitude; LatLng

watchPosition() vs getCurrentPosition() with setTimeout

本小妞迷上赌 提交于 2019-11-27 20:08:09
问题 I need to determine a person's location within 50m. I'm wondering if I should use navigator.location.watchPostion() or call getCurrentPostion() over and over again. watchPostion() is the proper W3C API for doing what I want, but practically, it seems to be overkill. Here's my code: var map = null; var marker = null; var layer = null; function locFn(pos) { var lat = pos.coords.latitude; var lon = pos.coords.longitude; $("#hlat").val(lat); $("#hlong").val(lon); document.getElementById("lnkMap")

Quicker way to calculate geographic distance between two points

浪尽此生 提交于 2019-11-27 19:54:41
I borrowed the following method from somewhere on the internet (Can't remember where). But its doing a straight forward process, finding the distance between two gps points. It works just fine, except that it may be a little slow, as I'm running it across millions of points. I was wondering if anyone knows an approach that would be computationally less expensive. The accuracy needs to be in the general area of 'correct' but doesn't need to be 100% accurate. private double distFrom(double lat1, double lng1, double lat2, double lng2) { double earthRadius = 3958.75; double dLat = Math.toRadians

check if location setting has been turned off in users browser

梦想的初衷 提交于 2019-11-27 19:51:34
I would like to hide() or show() a button that allows users to use their current location based on whether or not they are currently allowing location to be used in their browser setting. the below code only checks if the browser supports geolocation and not whether or not the particular user is allowing it. if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { x.innerHTML="Geolocation is not supported by this browser.";} } Is there a boolean value that I can detect for their browser setting letting me know if location is currently allowed? thanks for

Using navigator.geolocation.getCurrentPosition in WebView on Android 2.0+ (PhoneGap related)

两盒软妹~` 提交于 2019-11-27 19:30:55
I've been working with PhoneGap and it's been great, but I've run into a problem with getting location on a Verizon Droid w/ 2.0.1 (works as expected on a G1 w/ 1.6). GeoLocation API Support was added to Android in 2.0 (Eclair) and it works in the default browser on a Verizon Droid (on 2.0.1). That is, if I visit a website that calls navigator.geolocation.getCurrentPosition(success_callback, error_callback), the device prompts that the current domain "wants to know your location" in a dialog with options to "Share location" or "decline". If I select "Share location", success_callback

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

◇◆丶佛笑我妖孽 提交于 2019-11-27 19:27:56
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 when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super

Geolocation MySQL Query

二次信任 提交于 2019-11-27 19:26:07
问题 I run a geolocation-based social network. Members can see other members based on how close they are. Right now my MySQL query looks like: $lat_min = $geo['user_lat'] - 5; $lat_max = $geo['user_lat'] + 5; $long_min = $geo['user_long'] - 5; $long_max = $geo['user_long'] + 5; $members_query = "SELECT " . $fields . " FROM members WHERE (user_lat BETWEEN " . $lat_min . " AND " . $lat_max . " AND user_long BETWEEN " . $long_min . " AND " . $long_max . ") OR (gc_lat BETWEEN " . $lat_min . " AND " .

How to get visitor location ( country, state and city ) using ASP.NET

余生颓废 提交于 2019-11-27 19:14:58
问题 I want to implement this in ASP.NET. I don't have any idea about how to do so, unfortunately. 回答1: Here how it is done in asp.net Request.ServerVariables("REMOTE_ADDR") Get a copy of IP adress database by location here http://www.maxmind.com/ 回答2: Why not use Google Analytics? You will get more than what you need. Alternatively you can get the client's ip and use service like ip2location to get the location. Check this similar question as well. finding clients location in asp.net page. 回答3:

PHP MySql and geolocation

拟墨画扇 提交于 2019-11-27 19:11:35
I am writing a site that basically looks for places within a 25 mile radius of a lat and long using php and mysql. I am wondering how something like this would work? I would pass a lat and long to the scrip and have it pull out only locations that are within 25 miles of the lat and long from my Database of locations. What is the best way to do this? EDIT: I found this code for calculating the distance between 2 points. function distance($lat1, $lon1, $lat2, $lon2, $unit) { $theta = $lon1 - $lon2; $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) *