latitude-longitude

How to get the nearest area from a list of locations?

笑着哭i 提交于 2019-11-30 10:39:34
I have a API which returns a list of different areas within a city with the weather at that area. I want to get the nearest area based on my current location. API returns Area Latitude Longitude Weather How to find the nearest area based on this data? You would have to create CLLocation objects for all the areas, plus one for the current location of the user. Then use a loop similar to the one below to get the closest location: NSArray *allLocations; // this array contains all CLLocation objects for the locations from the API you use CLLocation *currentUserLocation; CLLocation *closestLocation

Which data type for latitude and longitude?

依然范特西╮ 提交于 2019-11-30 10:23:01
问题 I am newbie to PostgreSQL and PostGIS. I want to store latitude and longitude values in PostgreSQL 9.1.1 database table. I will calculate distance between two points, find nearer points by using this location values. Which data type should I use for latitude and longitude? 回答1: You can use the data type point - combines (x,y) which can be your lat / long. Occupies 16 bytes: 2 float8 numbers internally. Or make it two columns of type float (= float8 or double precision ). 8 bytes each. Or real

leaflet square given centre and square width

有些话、适合烂在心里 提交于 2019-11-30 10:01:20
问题 On Leaflet I can create a new circle easily given the centre and the radius: // Circle var radius = 500; // [metres] var circleLocation = new L.LatLng(centreLat, centreLon); var circleOptions = { color: 'red', fillColor: '#f03', fillOpacity: 0.5 }; var circle = new L.Circle(circleLocation, radius, circleOptions); map.addLayer(circle); The circle above is created and drawn without problems, so it is all. However, if I wanted now to create and draw a rectangle that which bounds the circle, it

Convert longitude/latitude to x/y on iPhone

末鹿安然 提交于 2019-11-30 09:50:56
I am showing an image in an UIImageView and i'd like to convert coordinates to x/y values so i can show cities on this image. This is what i tried based on my research: CGFloat height = mapView.frame.size.height; CGFloat width = mapView.frame.size.width; int x = (int) ((width/360.0) * (180 + 8.242493)); // Mainz lon int y = (int) ((height/180.0) * (90 - 49.993615)); // Mainz lat NSLog(@"x: %i y: %i", x, y); PinView *pinView = [[PinView alloc]initPinViewWithPoint:x andY:y]; [self.view addSubview:pinView]; which gives me 167 as x and y=104 but this example should have the values x=73 and y=294.

Finding nearest street given a lat-long location

半城伤御伤魂 提交于 2019-11-30 09:39:36
Is there any such API where given a location (in terms of latlong), I could find whether the given point is on road/street or not. And if possible also gives me nearest street/road to that location. I found API from [Find nearby Streets] -> http://www.geonames.org/maps/us-reverse-geocoder.html#findNearbyStreets , but it just gives solution for US. Help me if u know of any better solution/algorithm. ( I am particularly interested in India.) Mathias Schwarz You can use the Google Maps Geocoding API which does exactly that: https://developers.google.com/maps/documentation/geocoding/intro Take a

How to calculate angle between two Geographical/GPS coordinates?

帅比萌擦擦* 提交于 2019-11-30 08:36:22
问题 I have two GPS Coordinates e.g. (Lat1, Long1) and (Lat2,Long2) Could anybody please help me find the angle between those two points. Values should be 0-360 degrees. 回答1: Taken from this previous SO post: float dy = lat2 - lat1; float dx = cosf(M_PI/180*lat1)*(long2 - long1); float angle = atan2f(dy, dx); 回答2: I suppose you mean the bearing to and not the angle between the locations: If (lat1,long1) is stored in a Location object loc1 and (lat2,long2) is stored in loc2 you get the bearing from

Converting UTM (wsg84) coordinates to Latitude and Longitude

。_饼干妹妹 提交于 2019-11-30 08:26:38
I've been searching for a while now (here and on google obviously) for a neat way to convert a set of UTM coordinates to Latitude and Longitude. I've got the coordinates and I know in what zone they are, but how do I convert this to Latitude and Longitude? I Was hoping there would be some kind of class that could do at least some of the magic for me, but it doesn't seem so :( Any suggestions on this? I know it can be done, as this converter seems to work just fine Geographic/UTM Coordinate Converter . Any input is greatly appreciated! :) Thanks! Take a look at this .NET library http://projnet

Determine longitudes and latitudes within a range

旧巷老猫 提交于 2019-11-30 07:46:47
I have locations in my database. A location has the attributes latitude and longitude (taken from google maps, example: 48.809591). Is there any query that could help me retrieve the locations within a range of another location? Example: I have the location A with latitude = 48.809591, and longitude = 2.124009 and want to retrieve all location objects in my database that are within 5 miles of location A My first thought was to retrieve the locations in a square where location.latitude < A.latitude + 5 miles and location.latitude > A.latitude - 5 miles and location.longitude < A.longitude + 5

How to find latitude and longitude using C#

混江龙づ霸主 提交于 2019-11-30 06:20:47
问题 I have a WCF service in C#. In the Service call client sends a city name. I want to convert the city name to latitudes and longitudes and store in Database under demographics. I am planning to use Google API to implement above functionality. I have obtained an API key from Google and its of type 'Service account'. How can I obtain the latitude and longitude using which APIs? Do I need to install some SDK or any REST Service will do? 回答1: If you want to use the Google Maps API have a look at

Tiger/Lines or shapefiles of USA states and cities?

佐手、 提交于 2019-11-30 05:52:07
i've been asked to generate some demographic reports (crime rates, birth/deaths, etc) based on state and cities for the USA. I have all the demographic data (provided by our client) but can't seem to find any places which have the boundaries (read: LAT/LONG's) of the USA States and their cities. Our data are Lat/Long points of data (eg. a crime, a birth, etc) and we want to get some mapped reports and also datamine using Sql server (we're using MS Sql 2008, but that shouldn't impact this question). So .. can anyone direct me to where there are some state and city boundary sources ? I know our