geography

Java, convert lat/lon to UTM [closed]

混江龙づ霸主 提交于 2019-11-26 18:42:20
Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I'm currently looking at Geotools but unfortunately the solution is not obvious. No Library, No Nothing. Copy This! Using These Two Classes , You can Convert Degree(latitude/longitude) to UTM and Vice Versa! private class Deg2UTM { double Easting; double Northing; int Zone; char Letter; private Deg2UTM(double Lat,double Lon) { Zone= (int) Math.floor(Lon/6+31); if (Lat<-72) Letter='C'; else if (Lat<-64) Letter='D'; else if (Lat<-56) Letter='E'; else if (Lat<-48) Letter='F'; else if (Lat

Geospatial coordinates and distance in kilometers

淺唱寂寞╮ 提交于 2019-11-26 15:32:58
问题 This is a followup to this question. I seem to be stuck on this. Basically, I need to be able to convert back and forth to referring to coordinates either in the standard degree system OR by measuring a distance north from the south pole along the international date line, and then a distance east starting from that point on the date line. To do this (as well as some more general distance-measuring stuff), I have one method for determining the distance between two lat/lon points, and another

Getting distance between two points based on latitude/longitude

别来无恙 提交于 2019-11-26 14:58:22
I tried implementing this formula: http://andrew.hedges.name/experiments/haversine/ The aplet does good for the two points I am testing: Yet my code is not working. from math import sin, cos, sqrt, atan2 R = 6373.0 lat1 = 52.2296756 lon1 = 21.0122287 lat2 = 52.406374 lon2 = 16.9251681 dlon = lon2 - lon1 dlat = lat2 - lat1 a = (sin(dlat/2))**2 + cos(lat1) * cos(lat2) * (sin(dlon/2))**2 c = 2 * atan2(sqrt(a), sqrt(1-a)) distance = R * c print "Result", distance print "Should be", 278.546 The distance it returns is 5447.05546147 . Why? Edit: Just as a note, if you just need a quick and easy way

Is it possible to use SqlGeography with Linq to Sql?

半城伤御伤魂 提交于 2019-11-26 14:12:18
问题 I've been having quite a few problems trying to use Microsoft.SqlServer.Types.SqlGeography . I know full well that support for this in Linq to Sql is not great. I've tried numerous ways, beginning with what would the expected way (Database type of geography , CLR type of SqlGeography ). This produces the NotSupportedException , which is widely discussed via blogs. I've then gone down the path of treating the geography column as a varbinary(max) , as geography is a UDT stored as binary. This

How to find distance from the latitude and longitude of two locations?

别说谁变了你拦得住时间么 提交于 2019-11-26 09:30:09
问题 I have a set of latitudes and longitudes of locations. How to find distance from one location in the set to another? Is there a formula ? 回答1: The Haversine formula assumes a spherical earth. However, the shape of the earh is more complex. An oblate spheroid model will give better results. If such accuracy is needed, you should better use Vincenty inverse formula . See http://en.wikipedia.org/wiki/Vincenty's_formulae for details. Using it, you can get a 0.5mm accuracy for the spheroid model.

Geographical boundaries of states/provinces -> Google Maps Polygon

青春壹個敷衍的年華 提交于 2019-11-26 07:57:16
问题 I\'m building a web application that is going to dynamically highlight certain U.S. states and Canadian provinces on a Google Map, based on buttons and click events. Plan A) Polygons My primary idea for this was to draw Polygons. For this I need lists of coordinates (latitude + longitude) of all state and province outlines (clockwise or counter-clockwise). On government websites I found all sorts of different formats (i.e. E00), but I have trouble converting these formats into a simple list

Java, convert lat/lon to UTM [closed]

家住魔仙堡 提交于 2019-11-26 06:31:09
问题 Does anyone know of a way, in Java, to convert an earth surface position from lat, lon to UTM (say in WGS84)? I\'m currently looking at Geotools but unfortunately the solution is not obvious. 回答1: No Library, No Nothing. Copy This! Using These Two Classes , You can Convert Degree(latitude/longitude) to UTM and Vice Versa! private class Deg2UTM { double Easting; double Northing; int Zone; char Letter; private Deg2UTM(double Lat,double Lon) { Zone= (int) Math.floor(Lon/6+31); if (Lat<-72)

Getting distance between two points based on latitude/longitude

对着背影说爱祢 提交于 2019-11-26 03:04:49
问题 I tried implementing this formula: http://andrew.hedges.name/experiments/haversine/ The aplet does good for the two points I am testing: Yet my code is not working. from math import sin, cos, sqrt, atan2 R = 6373.0 lat1 = 52.2296756 lon1 = 21.0122287 lat2 = 52.406374 lon2 = 16.9251681 dlon = lon2 - lon1 dlat = lat2 - lat1 a = (sin(dlat/2))**2 + cos(lat1) * cos(lat2) * (sin(dlon/2))**2 c = 2 * atan2(sqrt(a), sqrt(1-a)) distance = R * c print \"Result\", distance print \"Should be\", 278.546

Calculate distance between 2 GPS coordinates

夙愿已清 提交于 2019-11-25 22:57:51
问题 How do I calculate distance between two GPS coordinates (using latitude and longitude)? 回答1: Calculate the distance between two coordinates by latitude and longitude, including a Javascript implementation. West and South locations are negative. Remember minutes and seconds are out of 60 so S31 30' is -31.50 degrees. Don't forget to convert degrees to radians . Many languages have this function. Or its a simple calculation: radians = degrees * PI / 180 . function degreesToRadians(degrees) {