geolocation

Find centerpoint of polygon in JavaScript

痞子三分冷 提交于 2019-11-28 23:46:13
I have a "place" object from Google Maps which has a set of coordinates that represent a bounding box for a given location, say London. Each set of coordinates has a latitude and longitude. I have written the below code to find the centerpoint, but I am not sure if it does actually produce the centerpoint. What if the polygon has 5 points instead of 4? Also, can this be done in a more efficient way, with less operations? function average(array) { // Add together and then divide by the length return _.reduce(array, function (sum, num) { return sum + num; }, 0) / array.length; } // I have a two

Geo Spacial Bounding Box Rectangle Calculation Error: Latitude Incorrect

梦想的初衷 提交于 2019-11-28 23:26:27
问题 Can any trig or GPS experts help me out here? I'm trying to create a geo-spacial bounding box (rectangle) calculation returning the maximum latitude and longitude using the following method that I've retrieved. I am calling the method once for each of the for bearings: north, south, east and west. With these four values I intend to query my Core Data store for all objects within the box. -(CLLocation*) offsetLocation:(CLLocation*)startLocation:(double)offsetMeters:(double)bearing { double

How to get Location (latitude & longitude value) in variable on iOS?

为君一笑 提交于 2019-11-28 23:24:06
I would like to use the location of my app user, more specifically the latitude and longitude value. I need them to use in a variable, so that I can send them with an url... I never worked before withe locations on iOS and Xcode and found nothing matching for my problem on the Internet... So I hope someone can explain it to my with a code sample :) Thx for u help Laurenz from Germany Peter Zhou You can use CoreLocation to get the longitude and latitude. Include framework: Click your project in navigator. Click the plus button under "link binary with libraries" Add Corelocation to your project.

Geolocation Without SSL connection

孤者浪人 提交于 2019-11-28 22:58:43
问题 I am developing an application which uses geolocation coordinates. I used the HTML5 geolocation feature to find out the location of the site visitor, but the issue is with Chrome which doesnt support GeoLocation on insecure origins. function showPosition(){ if(navigator.geolocation){ navigator.geolocation.getCurrentPosition(function(position){ var positionInfo = "Your current position is (" + "Latitude: " + position.coords.latitude + ", " + "Longitude: " + position.coords.longitude + ")";

How does Chrome know my geolocation?

断了今生、忘了曾经 提交于 2019-11-28 22:30:19
问题 Chrome seems to be very accurate in detecting my location. How does it do it? Can you point me to the source code? 回答1: Geolocation can be calculated based on: GPS (if available) Available wi-fi networks and signal strengths Available cell towers and signal strengths IP Address lookup See the W3C Geolocaton API and Google Gears API (which Chrome's/W3C Geolocation API is based on). Chromium's geolocation source code can be viewed online. 回答2: Your location can be obtain using different

Ip address to country with database [closed]

折月煮酒 提交于 2019-11-28 22:11:17
I have downloaded ip-to-country.csv that has ip ranges that are mapped to countries. How should I store this data to database and how can I query in what range Ip address is to know where Ip address is coming from? Omry Yadan I wrote a small lib called ip2c to do just that. it uses the database from webhosting.info but also supports that from Software77 . It converts the CSV info a compact binary format and can do the search straight on the file, in memory or in a memory mapped file. The Java API usage is similar to this: String ip = 85.64.225.159; int caching1 = IP2Country.NO_CACHE; //

Geolocation provider for Firefox that allows manual input

家住魔仙堡 提交于 2019-11-28 22:07:30
问题 Are there any easy ways to override the default behaviors of the geolocation api and just hard code your current location? I think this would be useful for testing and for privacy reasons (providing fake location data) I thought there was an add on for this but I can't seem to find one. Only option right now seems to be changing the about:config geo.wifi.url to some alternative webservice, which I consider overly complicated. Any ideas? Thanks Ideal Scenario Somebody implements an add-on

Can a broadcastReceiver catch multiple broadcasts?

两盒软妹~` 提交于 2019-11-28 21:59:30
I am trying to create multiple proximity alerts but I cant get it to work... I think that the broadcast receiver gets overwritten and thus is handling only the last broadcast. So if I had two points close by only the one whose intent was created last will generate an alert... I read that I should use request codes but I have no idea on how to do that... My method for setting up the pending intents and the broadcast receiver... private void addProximityAlert(double latitude, double longitude, String poiName, String intentfilter) { Bundle extras = new Bundle(); extras.putString("name", poiName);

Calculate bearing between two locations (lat, long)

别来无恙 提交于 2019-11-28 21:19:10
问题 I'm trying to develop my own augmented reality engine. Searching on internet, I've found this useful tutorial. Reading it I see that the important thing is bearing between user location, point location and north. The following picture is from that tutorial. Following it, I wrote an Objective-C method to obtain beta: + (float) calculateBetaFrom:(CLLocationCoordinate2D)user to:(CLLocationCoordinate2D)destination { double beta = 0; double a, b = 0; a = destination.latitude - user.latitude; b =

Google maps API - Center map on client's current location

冷暖自知 提交于 2019-11-28 21:05:51
I've looked at the various other times this question has been asked but I can't quite put a finger on where I'm going wrong, here's my code: <html> <head> <title> Map </title> <style> html, body, #map-canvas { margin: 0; padding: 0; height: 500px; width: 800px;} </style> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script> <script> var map; function initialize() { var myLatlng1 = new google.maps.LatLng(53.65914, 0.072050); var mapOptions = { zoom: 10, center: myLatlng1, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document