geo

calculate the area of a polygon in ruby

人盡茶涼 提交于 2019-12-08 03:16:44
问题 I have an array of latitude/longitude coordinate pairs that represent a polygon. I'm trying to determine the total area within that polygon. How would I go about doing that in Ruby? Here's an example array of the polygon: [[37.7663613767094, -122.452969210084], [37.7674219449606, -122.444718340349], [37.7701838510542, -122.445330289514], [37.7709974013834, -122.439159589248], [37.7700761930893, -122.438861402472], [37.7703501163684, -122.436868738421], [37.7712650571321, -122.437078116573],

Ensure padding around markers on Google Maps for web [duplicate]

China☆狼群 提交于 2019-12-08 03:10:28
This question already has answers here : Google Maps API 3 fitBounds padding - ensure markers are not obscured by overlaid controls (7 answers) Closed 3 years ago . I have a full screen Google map with HTML/CSS toolbars overlaid on the map, and a set of map markers. Is there a way to ensure there is enough padding between the markers and the edges of the map, so that no markers are obscured by the toolbars? ( Codepen in case the code below doesn't work) function initMap() { var map = new google.maps.Map(document.getElementById('map'), { draggable: true, streetViewControl: false, zoomControl:

How to plot geo-data using matplotlib/python

百般思念 提交于 2019-12-07 15:14:20
问题 I am trying to plot a polygone on python, using different libararies, but no one of these worked with me. I tried vincent ,Shapely , .. and now matplotlib. I don't wanna use softwares like qgis I used this example: http://geographika.co.uk/visualising-geojson-in-15-minutes EDIT: Archive of original blog post: https://web.archive.org/web/20160310165846/http://geographika.co.uk/visualising-geojson-in-15-minutes from matplotlib import pyplot from descartes import PolygonPatch import math import

Maximum length of a decimal latitude/longitude Degree?

会有一股神秘感。 提交于 2019-12-07 06:08:57
问题 What is the maximum length (in kilometers or miles - but please specify) that one degree of latitude and longitude can have in the Earth surface? I'm not sure if I'm being clear enough, let me rephrase that. The Earth is not a perfect circle, as we all know, and a change of 1.0 in the latitude / longitude on the equator (or in Ecuador) can mean one distance while the same change at the poles can mean another completely different distance. I'm trying to shrink down the number of results

HTML5 Geolocation API和Google Maps API结合实现路线导航

百般思念 提交于 2019-12-06 16:52:42
HTML5提供了地理位置定位功能(Geolocation API),能确定用户位置,我们可以借助HTML5的该特性开发基于地理位置信息的应用。本文结合实例给大家分享如何使用HTML5,借助百度、谷歌地图接口来获取用户准确的地理位置信息。 定位功能(Geolocation)是HTML5的新特性,因此只有在支持HTML5的现代浏览器上运行,特别是手持设备如iphone,地理定位更加精确。首先我们要检测用户设备浏览器是否支持地理定位,如果支持则获取地理信息。注意这个特性可能侵犯用户的隐私,除非用户同意,否则用户位置信息是不可用的,所以我们在访问该应用时会提示是否允许地理定位,我们当然选择允许即可。 function getLocation(){ if (navigator.geolocation){ navigator.geolocation.getCurrentPosition(showPosition,showError) }else{ alert("浏览器不支持地理定位。") } } 上面的代码可以知道,如果用户设备支持地理定位,则运行 getCurrentPosition() 方法。如果getCurrentPosition()运行成功,则向参数showPosition中规定的函数返回一个coordinates对象,getCurrentPosition()

How can I make a custom SVG overlay on Leaflet without using D3?

核能气质少年 提交于 2019-12-06 15:37:25
I have recently started a small project that involves drawing transport scheme on top of the Leaflet map. I've got a collection (array) of points denoting stops, each having an attribute location (LatLng). How can I place them on the map without using native markers but using SVG layer with paths & circles instead and guaranteeing the correct geographical placement of elements on every dragging or zooming of the map? So far, I've thought of: Using the SVG overlay provided by Leaflet inside the overlay pane on the map. The problem with this approach is that I have a feeling it was designed

Get latitude and longitude points along a line between two points, by percentage

a 夏天 提交于 2019-12-06 12:54:30
问题 In the image below, you can see that there 3 lines drawn from one point (the black circle) to its 3 related points (). IMAGE QUESTION How to calculate latitude and longitude point between points along each line, using a percentage of the distance between the two points? For example, if I wanted to get the position to be able to draw additional circles along each line with a 20% difference? WHAT CODE I HAVE NOW var data = [ { "coords" : [ 53.409045, -2.985406 ]}, { "coords" : [ 53.408747, -2

Scale a circle's radius (given in meters) to D3.js d3.geo.mercator map

不问归期 提交于 2019-12-06 09:23:13
I am using D3.js and TopoJSON libraries to render a flat SVG map of the world in a small div on a web page. I'm also taking some geographic objects (polygons and circles), and plotting them on this map via lat/long coordinates. This all seems to be working pretty well, however, the circle objects that I am plotting on the map contain a radius element which is given in meters. I cannot find or figure out how to convert/scale this measurement appropriately onto the SVG map. Any help would be greatly appreciated. The snippet of code that is drawing the circle and setting is: if

How to plot geo-data using matplotlib/python

ε祈祈猫儿з 提交于 2019-12-05 20:03:24
I am trying to plot a polygone on python, using different libararies, but no one of these worked with me. I tried vincent , Shapely , .. and now matplotlib. I don't wanna use softwares like qgis I used this example: http://geographika.co.uk/visualising-geojson-in-15-minutes EDIT: Archive of original blog post: https://web.archive.org/web/20160310165846/http://geographika.co.uk/visualising-geojson-in-15-minutes from matplotlib import pyplot from descartes import PolygonPatch import math import urllib2 import simplejson data = [] with open('file.json') as f: for line in f: data.append(json.loads

Redis Geo HyperLogLog类型介绍

核能气质少年 提交于 2019-12-05 17:57:36
​Geo类型 Redis3.2.0版本推出 可以将用户给定的地理位置信息存储起来,并对这些信息进行操作 GEOADD key longitude latitude member [longitude latitude member ...] //在使用排序集表示的地理空间索引中添加一个或多个地理空间项,时间复杂度O(log(N)) 127.0.0.1:6379> geoadd key1 121.3996887207031 31.04559326171875 member1 116.3883056640625 39.92889404296875 member2 (integer) 2 GEODIST key member1 member2 [unit] //返回地理空间索引的两个成员之间的距离,时间复杂度O(log(N)) 127.0.0.1:6379> geodist key1 member1 member2 "1086809.8477"//默认单位为m 127.0.0.1:6379> geodist key1 member1 member2 m "1086809.8477" 127.0.0.1:6379> geodist key1 member1 member2 km "1086.8098" 127.0.0.1:6379> geodist key1 member1 member2