tag:blogger.com,1999:blog-4113082053753185517.post8505462638687822442..comments2023-07-02T13:50:28.495+02:00Comments on Samuel Bosch: Working in lat long: great circle distance, bearing, midpoint and centroid calculationsSamuel Boschhttp://www.blogger.com/profile/00902576471871535529noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-4113082053753185517.post-77802993965922277162018-10-09T11:37:25.160+02:002018-10-09T11:37:25.160+02:00Hi, sorry but I don't understand the comment
...Hi, sorry but I don't understand the comment <br />"A = Point(long1, lat1)<br />B = Point(long2, lat2)"<br /><br />To measure distance I use the following:<br />#function to measure distance<br />def haversine_np(StatLng, StatLat, reallng, reallat):<br /> #a = row.reallat + row.reallng<br /> reallng , reallat , StatLng , StatLat = map(np.radians, [ reallng , reallat , StatLng , StatLat ])<br /> dlon = reallng - StatLng<br /> dlat = reallat - StatLat<br /> a = np.sin(dlat/2.0)**2 + np.cos( StatLat ) * np.cos( reallat ) * np.sin(dlon/2.0)**2<br /> c = 2 * np.arcsin(np.sqrt(a))<br /> km = 6371 * c<br /> return km<br /><br />What I'm looking for is the same type of thing to return bearing, which I think is what you have written but the A & B format for points loses me sorry. can you please explain in very simple terms as I expect to pass 2 pairs of values (lat1, lng1 & lat2, lng2) Thx! bombaygiraffehttps://www.blogger.com/profile/01061074576318762342noreply@blogger.comtag:blogger.com,1999:blog-4113082053753185517.post-4022106582665865212018-04-24T11:52:27.079+02:002018-04-24T11:52:27.079+02:00Take a look at this equations, they should give yo...Take a look at this equations, they should give you the result you need:<br />http://www.movable-type.co.uk/scripts/latlong.html#destPointSamuel Boschhttps://www.blogger.com/profile/00902576471871535529noreply@blogger.comtag:blogger.com,1999:blog-4113082053753185517.post-61620560599541587802018-04-23T19:50:24.749+02:002018-04-23T19:50:24.749+02:00Thanks Samuel thats really helpful. Need one help,...Thanks Samuel thats really helpful. Need one help, I am trying to find point B(la/long) from another point A(lat/long) towards some distance and bearing.<br />Eg: 50 metres towards 45 degree ( w.r.t north) from a list of lat/long in csvAnup Pandeyhttps://www.blogger.com/profile/17877849309839073301noreply@blogger.comtag:blogger.com,1999:blog-4113082053753185517.post-69080176910444200842018-04-16T10:11:01.106+02:002018-04-16T10:11:01.106+02:00A and B are your points, in your case this could b...A and B are your points, in your case this could be:<br />A = Point(long1, lat1)<br />B = Point(long2, lat2)Samuel Boschhttps://www.blogger.com/profile/00902576471871535529noreply@blogger.comtag:blogger.com,1999:blog-4113082053753185517.post-76522037171201150352018-04-15T23:12:45.381+02:002018-04-15T23:12:45.381+02:00What is A,B...how to append since I have for value...What is A,B...how to append since I have for values..lat1, lat2,long1, long2Anup Pandeyhttps://www.blogger.com/profile/17877849309839073301noreply@blogger.comtag:blogger.com,1999:blog-4113082053753185517.post-45156261241244521592015-03-18T02:09:17.687+01:002015-03-18T02:09:17.687+01:00Dude, Thanks, I screwed up in using the lat and lo...Dude, Thanks, I screwed up in using the lat and lon. It works Awesome. Thanks<br /><br />Happy St Patrick's DaydBaaphttps://www.blogger.com/profile/15253257624660381639noreply@blogger.comtag:blogger.com,1999:blog-4113082053753185517.post-63771076326010476552015-03-18T01:58:41.747+01:002015-03-18T01:58:41.747+01:00Hi Samuel, nice post there some of these functions...Hi Samuel, nice post there some of these functions are really helpful. So going through it I came across the following case<br /><br />lat,long = 34.076419095,-118.291352314<br /><br />So when I call the function <br />get_centroids([Point(lat,long)]) <br />returns (-145.923580905,-61.708647686)<br /><br />Correct me if I am wrong, but guess with one point, the centroid should be the same as the given point right ?dBaaphttps://www.blogger.com/profile/15253257624660381639noreply@blogger.com