latitude-longitude

Offset LatLng by some amount of meters in Android

我的未来我决定 提交于 2019-12-05 09:08:51
I have a LatLng object and I want to shift it's coordinates 500 meters to the east. I couldn't find a built-in method for that. I've seen https://gis.stackexchange.com/a/2964 but my results are just too inaccurate (about 15%) to use practically. How can I make a precise shift in meters? Note: I am NOT looking for shifting a Google Maps camera, I know how to do that. I've tried: static final double KILOMETERS_PER_DEGREE = 111.111; static LatLng offsetLongitude(LatLng initialCoords, float horizontalOffsetInMeters){ double degreeOffset = 1.0 / KILOMETERS_PER_DEGREE * horizontalOffsetInMeters /

how to get the current location latitude and longitude of android mobile device?

╄→尐↘猪︶ㄣ 提交于 2019-12-05 09:04:09
问题 I have implemented sample application for get the current location latitude longitude.If i lunch my application in emulator and i am sending latitude and longitude from Emulator Controls at eclipse then i am getting current location latitude and longitude which from emulator controls.If i lunch the same application in real device then i am not able to get current location latitude and longitude I have implemented code for get the current location latitude and longitude as follows:

convert latitude and longitude to x and y grid system using python

家住魔仙堡 提交于 2019-12-05 07:47:29
I have file with latitude and longitude values, that i want to convert the x and y in km I want to measure the distance from each point. for instance I make the first points of latitude and longitude(which are 51.58, -124.6 respectfully) to (0,0) in my x and y system so than basically i want to find out what the other points are and their location from the origin so i want to find what 51.56(lat) -123.64(long) is in (x,y) in km and so on for the rest of the file. I want to do this all in python, is there some sort code ? I found sites online , for instance http://www.whoi.edu/marine/ndsf/cgi

Find nearest places by latitude and longitude

谁说我不能喝 提交于 2019-12-05 06:57:26
问题 I have this website that stores latitude and longitude of some places and I want to display the nearest places (lets say, in a radius of 10km) of a specific place. How do I search on my MySQL table for these places? 回答1: I answered this kind of question some years ago at Google Answers and again more recently at Uclue. I should note that the preferred technical convention is to represent longitudes in the West as negative values, but this is sometimes not observed. It won't make much

Distance between two lat,lon points

霸气de小男生 提交于 2019-12-05 06:08:14
Is it ok to compare distances in a classic way (distance between 2 points: d = sqrt(pow(lat2-lat1, 2) + pow(lon2-lon1, 2)) ) using the latitude and longitude returned from google apis without any transformation to meters or sth? I need it just for a comparison to find the closest point from a series of points to a reference point. For example: Lets say we have two (lat,lon) points: (40.2535425,22.88245345) and (40.2565795,22.8884539) and we want to find witch is closest to (40.2335425,22.83245345). Is it ok to apply the above code to find the distances? Or we need to find the distance, lets

How to calculate delta latitude and longitude for MapView component in React-Native?

妖精的绣舞 提交于 2019-12-05 05:10:23
How can i calculate delta-latitude and delta-longitude values form latitude and longitude values for MapView component in React-Native. Thank You If you have an array of coordinates and you want a region that will fit all these points, you can do something like this: const regionContainingPoints = points => { let minLat, maxLat, minLng, maxLng; // init first point (point => { minLat = point.latitude; maxLat = point.latitude; minLng = point.longitude; maxLng = point.longitude; })(points[0]); // calculate rect points.forEach(point => { minLat = Math.min(minLat, point.latitude); maxLat = Math.max

identify which is the polygon from latitude and longitude

百般思念 提交于 2019-12-05 04:30:06
I have a map drawn using leaflet.js. If I give longitude and latitude value as input Can I identify the polygon? Can I get a client side script for this? Got an answer as follows : //This is based on 'point in polygon algorithm' function getPoint () { float x=-89.82421875; //x and y represents the lat and lng values float y= 40.18307014852533; var a = boundaries; //the coordinates used to draw the map for (i = 0; i < a.features.length; i++) { PointInPolygon(x,y, a.features[i].geometry.coordinates[0], i); } }; function PointInPolygon(pointX, pointY, _vertices, number) { var j = _vertices.length

Taking np.average while ignoring NaN's?

雨燕双飞 提交于 2019-12-05 04:26:04
I have a matrix with shape (64,17) correspond to time & latitude. I want to take a weighted latitude average, which I know np.average can do because, unlike np.nanmean, which I used to average the longitudes, weights can be used in the arguments. However, np.average doesn't ignore NaN like np.nanmean does, so my first 5 entries of each row are included in the latitude averaging and make the entire time series full of NaN. Is there a way I can take a weighted average without the NaN's being included in the calculation? file = Dataset("sst_aso_1951-2014latlon_seasavgs.nc") sst = file.variables[

Google Maps Android API v2 detect long press on map and add marker not working

拟墨画扇 提交于 2019-12-05 00:21:06
I want to add a marker on map with long press. Toast in onMapClick() was display with normal tap. But long press is not working. Toast in onMapLongClick() is not displayed with long press. Also marker is not displayed on map. I'm using SupportMapFragment because I want to use my application on Android 2.x devices. I have tested my app on Nexus One which has Android version 2.3.7. This is my code. public class MainActivity extends FragmentActivity implements OnMapClickListener, OnMapLongClickListener { final int RQS_GooglePlayServices = 1; private GoogleMap myMap; Location myLocation; @Override

how to group data by LatLong distance in R

别说谁变了你拦得住时间么 提交于 2019-12-04 23:26:52
I have a function distance(lat1,lon1, lat2,lon2) that calculates the distance of 2 points. Suppose I have a dataframe with some points and values: n<-c(lon = -1.729219, lat = 29.730836) o<-c(lon = -5.041928, lat = 28.453022) e<-c(lon = -2.700067, lat = 29.198922) s<-c(lon = -5.212864, lat = 28.531739) centro<-matrix(c(n,o,e,s), ncol=2, byrow=TRUE) d<-data.frame(c=centro, amount=c(3.5,3.5,3.5,3.5), count=c(12,12,12,12)) colnames(d)<-c('lon','lat','amount','count') I want to get a a new frameset with the values aggregated to the closest one of them (I don't care wich) Suppose I have a rad of