google maps api 3 - Javascript - calculate distance between latlng as percentage -
i have google map. within map have bounding box. within box, have series of points. need function express position of point respect bounds - ie 25% top of box, 15% left.
i've tried countless (been @ day) different formulae, no result.
i thought work (pseudo code):
var y = ((point.latitude - ne.latitude) / (sw.latitude - ne.latitude)) * boundingboxheight
normally have convert degrees radians , convert miles or km using radius of earth @ equator distance calculations.
but in case can use degrees are. using following values pointlat
25% below nelat
.
var nelat = 62; var swlat = 58; var pointlat = 61; var y = ((nelat - pointlat)/(nelat - swlat))*100;
Comments
Post a Comment