latitude-longitude

How to calculate distance from lat/long in php?

半腔热情 提交于 2019-11-28 08:34:50
What I am trying to do is I have entries in the database which have a lat/long stored with them. I want to calculate the distance between users lat/long and entries lat/long (in DB). After that, I want to echo the ones with distance less than 500 meters. So far I am able to do this using foreach . <?php mysql_connect("localhost", "beepbee_kunwarh", "kunwar") or die('MySQL Error.'); mysql_select_db("beepbee_demotest") or die('MySQL Error.'); $Lat = $_REQUEST['Lat']; $long = $_REQUEST['long']; $query = mysql_query("SELECT a.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($Lat - Lat) * pi()/180 / 2), 2) +

matlab: splitting small arrays by latitude/longitude into individual grid cells of one large array

血红的双手。 提交于 2019-11-28 06:53:50
问题 I have multiple satellite orbit paths that cover different latitudes/longitudes, but are all bounded by the same overall lat/lon grid (below). I am trying to split the data from each orbit path into the corresponding 0.5x0.5 o lat/lon cell of the large grid. For example, I'm looking at individual satellite orbits that cross the Beaufort Sea, total lat/lon boundary below: lat = [82:-0.5:68]; lon = [-118:-0.5:-160]; I have 88 orbit files that cover different tracks over the Beaufort Sea. The

Projecting a point onto a path

余生颓废 提交于 2019-11-28 06:40:06
问题 Suppose I have an ordered array containing points (lat, lon) describing a path, and I also have a point (lat, lon) describing my current location. How can I project the point onto the path (and place the point in the appropriate place in the array)? What I tried is just simply by searching for the nearest two points and assume it's in the middle of them. It's a good guess, but sometimes fails. What would be a good way of doing this? 回答1: I see it like this: p0,p1 are path line segment

How to get more accuracy by GPS_PROVIDER

*爱你&永不变心* 提交于 2019-11-28 06:38:13
问题 I've a challenges task for getting very high accuracy . So I am using GPS_PROVIDER. But my code is getting incorrect accuracy . some time it shows me 10 to 50 meter from my current location . and some time it shows me 5 to 15 meter distance from my current location . I've tested it two devices as XOLO and Sony. I've completed involved with that problems and not able to fix it. This is my code:- @Override protected void onResume() { super.onResume(); if(mMap!= null) mMaprivate LatLng geo; map

How to get the marked speed limit of a road, out of longitude and latitude [closed]

怎甘沉沦 提交于 2019-11-28 06:01:41
I know that is not a technical question, but I don't know where else to ask. Is there a way to get the marked speed limit of a road from google or bing maps? or any other web service? You cannot obtain this information from Bing Maps or Google Maps. Nor am I aware of any other webservices that provide this information (certainly not any free ones). Open Street Map ( http://osm.org ) has the ability for ways to be recorded with the maxspeed tag. You could download the OSM planet dataset and host it in a spatial database such as SQL Server 2012, then create your own web service to query the

C# Sunrise/Sunset with latitude/longitude

試著忘記壹切 提交于 2019-11-28 04:31:47
Is there a way in C# to calculate given a latitude and longitude when the sun will set and rise for a given day? Javascript calculations here . Now you just need to port. Edit: the calculations are in the source code of this page now. Edit: here is a direct link to the source code. No need to go hunting through the html. I know this post is old, but in case anyone is still looking... CoordinateSharp is available as a Nuget package. It's a standalone packge that can handle sun as well as moon times. Celestial cel = Celestial.CalculateCelestialTimes(85.57682, -70.75678, new DateTime(2017,8,21));

Receive a WOEID by Lat, Long with Yahoos API

倖福魔咒の 提交于 2019-11-28 03:51:58
i searched a while but found nothing, thats simular to my problem. i'm trying to use the YAHOO Weather API, for example: http://weather.yahooapis.com/forecastrss?w=4097 i don't know the WOEID in my case, but i got latitude and longitude points. so my question is: is there a way to get the WOEID of a place by using lat and long points? This is now available through the recently released PlaceFinder API . Kudos to Yahoo! for providing yet another important piece of the Geo puzzle. Yahoo! PlaceFinder API allows you to find a corresponding WOEID for a latitude/longitude pair. Consider this example

How to identify timezone from longitude and latitude in iOS

社会主义新天地 提交于 2019-11-28 00:56:57
How can I find out which NSTimeZone a given longitude and latitude fall in? Roohul I have tried APTimeZones library. In my case I needed Timezone as well as country name from the lat long of a particular city. I went through the library to know how it works. It actually has a file in JSON format which has all the timezones along with their corresponding lat longs. it takes the lat long as input and loops through this JSON file comparing the distances of all the timezone's lat long from the input lat long. It returns the time zone which has shortest distance from the input lat long. But the

Mapview getLatitudeSpan and getLongitudeSpan not working

自闭症网瘾萝莉.ら 提交于 2019-11-28 00:14:05
Sometimes when trying to get the Latitude span or Longitude span of a mapview with getLatitudeSpan() and getLongitudeSpan() I get 0 and 360*1E6 respectively. This doesn't happen always but it is a problem, has anybody got this problem? Any workarounds? I tried using getProjection() too but I get the same problem. Here is the piece of code: MapView mapView = (MapView) findViewById(R.id.mapview); int lat = mapView.getLatitudeSpan(); // sometimes returns 0 int long = mapView.getLongitudeSpan(); // sometimes returns 360*1E6 I would detect the condition and schedule your work to try again after a

Calculate the area of a polygon with latitude and longitude

不羁的心 提交于 2019-11-27 22:47:59
问题 I have this code, written using this: source1 and this: source 2 public static double CalculatePolygonArea(IList<GpsLocation> coordinates) { double area = 0; if (coordinates.Count > 2) { for (var i = 0; i < coordinates.Count-1; i++) { GpsLocation p1, p2; p1 = coordinates[i]; p2 = coordinates[i + 1]; area += ToRad(p2.Longitude - p1.Longitude) * (2 + Math.Sin(ToRad(p1.Latitude)) + Math.Sin(ToRad(p2.Latitude))); area = area * R * R / 2; } } return Math.Abs(area); } Here is my test code: [Fact]