geolocation

get map latitude longitude from mouse position

ⅰ亾dé卋堺 提交于 2019-11-30 03:56:13
I am trying to convert the position of the mouse on a google map into a LatLng object. I see quite a few posts on getting the position from with the google map "click" event etc, like this: google.maps.event.addListener(map, 'click', function(event) { mouseLocation = event.latLng; }); But, this doesn't work for my purposes because I am not responding to a map event, I'm responding to a 'tapHold' event. Inside the tapHold event I'd like to get the latitude and longitude of the current mouse position. Actually I could see a function like this being useful in many ways beyond just a tapHold event

Rails + PostGIS errors migrating database

ぃ、小莉子 提交于 2019-11-30 03:52:49
I was following Daniel Azuma's talk on geospatial analysis with rails but I am having difficulty whenever I run rake db:migrate in the second project. The details of my setup are as follows: I am running Postgresql using Postgres.app which gives me version 9.1.3 of Postgres and 2.0.0 of PostGIS. I run into a few issues with the database.yml file, and running migrations. ( I have added the relevant gems and required their info in application.rb) My database.yml file looks like this: development: adapter: postgis postgis_extension: true host: localhost encoding: unicode database: my_app

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

GPS coordinates in background in cordova app

元气小坏坏 提交于 2019-11-30 02:46:10
问题 I'm currently doing a hybrid app using ionic/cordova. The app needs functionality where it pings our backend with its location every 1 minute or so and the backend API will answer if anything interesting is nearby. If the answer is yes the app will queue a local notification which hopefully will make the user open the app. This functionality is needed when the app is in background mode and even when the phone is locked. The app needs to be able to be deployed to both app store, google play

Geolocation Without SSL connection

ぐ巨炮叔叔 提交于 2019-11-30 02:33:13
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 + ")"; document.getElementById("result").innerHTML = positionInfo; }); } else{ alert("Sorry, your browser does

Geo Spacial Bounding Box Rectangle Calculation Error: Latitude Incorrect

风格不统一 提交于 2019-11-30 02:29:28
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 EARTH_MEAN_RADIUS_METERS = 6372796.99; double newLatitude = asin( sin(startLocation.coordinate.latitude) *

Geolocation: moving only google maps marker without reload the map

余生长醉 提交于 2019-11-30 02:29:27
I need to update only the marker when the device is moving or when the device is getting more accuracy. When the position change also reload the map and I need to move only the maker. I have the following code: if (navigator.geolocation) { navigator.geolocation.watchPosition( function(position){ var latitude = position.coords.latitude; var longitude = position.coords.longitude; var accuracy = position.coords.accuracy; var coords = new google.maps.LatLng(latitude, longitude); var mapOptions = { zoom: 20, center: coords, streetViewControl: false, mapTypeControl: false, navigationControlOptions:

How do I calculate the Azimuth (angle to north) between two WGS84 coordinates

半城伤御伤魂 提交于 2019-11-30 02:18:18
I have got two WGS84 coordinates, latitude and longitude in degrees. These points are rather close together, e.g. only one metre apart. Is there an easy way to calculate the azimuth of the line between these points, that is, the angle to north? The naive approach would be to assume a Cartesian coordinate system (because these points are so close together) and just use sin(a) = abs(L2-L1) / sqrt(sqr(L2-L1) + sqr(B2-B1)) a = azimuth L1, L2 = longitude B1, B2 = latitude The error will be larger as the coordinates move away from the equator because there the distance between two longitudinal

Reading Geotag data from image in php

亡梦爱人 提交于 2019-11-30 02:13:31
Does anyone know if there is a way to read geotag data from photos in PHP? Thanks Like everyone else has said, exif_read_data(); will do it. To go ahead and get all of the data, use these args: exif_read_data($img, 0, true); // where $img is the path to your image This function can only read headers from tiffs and jpegs and I'm pretty sure only jpegs may contain geotags. I've written a simple php script for use in the command line and posted it as a gist on github . Run the script like this: php exif.php It will echo out an array. Look for the coordinates here: [GPS] => Array [GPSLatitudeRef]

Using google maps API, how can we set the current location as the default set location using map.setCenter function?

自古美人都是妖i 提交于 2019-11-30 01:48:03
I am writing JavaScript code using Google Maps API. map = new google.maps.Map2(document.getElementById("map_canvas")); map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13); The above code sets the default location of the map canvas to Palo Alto. How can we write the script in such a way that the setCenter function automatically points to the current location of the client? You can use the HTML5 GeoLocation API in browsers that support it. if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(success, error); } else { alert('geolocation not supported'); } function