在另一个多边形内插入一个多边形应该在中心形成一个"洞"(参见谷歌地图五角大楼的例子).但是,我的程序仍然无法创建一个洞,而是使两层多边形线变为不可靠.
http://cl.ly/1c243E1V1G2M1D3H3c0O < - 我地图的图片
有人说改变坐标顺序解决了他们的问题,所以我选择了谷歌在他们的例子中给出的百慕大三角坐标,但是,它遇到了我之前遇到的同样的问题.相关代码如下:
var everythingElse = [
new google.maps.LatLng(25.774252, -82.190262),
new google.maps.LatLng(17.466465, -65.118292),
new google.maps.LatLng(34.321384, -63.75737),
new google.maps.LatLng(25.774252, -82.190262)
];
var circleOverlay = [
new google.maps.LatLng(25.774252, -80.190262),
new google.maps.LatLng(18.466465, -66.118292),
new google.maps.LatLng(32.321384, -64.75737),
new google.maps.LatLng(25.774252, -80.190262)
];
PropertySearch.tintPolygon = new google.maps.Polygon({
paths: [ everythingElse, circleOverlay ],
strokeColor: "#000000",
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: "#000000",
fillOpacity: 0.5
});
PropertySearch.tintPolygon.setMap(PropertySearch.map);
Run Code Online (Sandbox Code Playgroud) 你能在Elastic Search中执行子查询吗?
我找到了一份文件清单(通常约有5-20份文件).对于我想要执行搜索的每个文档,为它们提供一些自定义字段.
每个文档都是一个属性,我想分析每个属性的周围属性,以便评估它周围的属性的平均价格.
谢谢
当我添加:
fields: [ "doc['Location'].lon" ]
Run Code Online (Sandbox Code Playgroud)
在我的查询中,经度值与文档源中显示的不同.
在这里你可以看到我获取doc ['Latitude'].lon和.lat以及要比较的_source.Latitude的查询结果:
https://gist.github.com/d9533170f1f50fd27e87(注意 - 这些已经通过PHP中的json_decode传递,但在使用json_decode之前数据是相同的.)
当我使用"doc ['field_name'].distance(lat,lon)"尝试将距离作为字段添加到我的查询时,我首先注意到了这一点.我尝试了"script_fields"和"fields"键,每个键都有相同的结果.
更新:我注意到"doc ['Location'].lon"正在返回我认为应该是doc ['Location'].lat(lat和lon被切换.)
我正在为ElasticSearch数据源编写单元测试,但是,我的结果好坏参半.问题是match_all查询没有找到我提交的记录,但是,当我使用CURL以相同的顺序手动运行命令单元测试时,我能够找到记录.
我相信也许索引没有刷新,因此,我在提交记录后开始运行"刷新"api命令,但是,这也没有用.这是我的命令列表 - 如果有人有任何关于如何确保这些命令工作的建议,即使它们是立即连续运行的,也会有所帮助.
命令单元测试运行:
curl -XGET 'http://localhost:9200/test_index/_mapping'
curl -XDELETE 'http://localhost:9200/test_index/test_models'
curl -XPOST 'http://localhost:9200/test_index/test_models/_refresh' -d '{}'
curl -XPUT 'http://localhost:9200/test_index/test_models/_mapping' -d '{"test_models":{"properties":{"TestModel":{"properties":{"id":{"type":"string","index":"not_analyzed"},"string":{"type":"string"},"created":{"type":"date","format":"yyyy-MM-dd HH:mm:ss"},"modified":{"type":"date","format":"yyyy-MM-dd HH:mm:ss"}},"type":"object"}}}}'
curl -XPOST 'http://localhost:9200/test_index/test_models/_bulk' -d '{"index":{"_index":"test_index","_type":"test_models","_id":"test-model"}}
{"TestModel":{"id":"test-model","string":"Analyzed for terms","created":"2012-01-01 00:00:00","modified":"2012-02-01 00:00:00"}}
'
curl -XPOST 'http://localhost:9200/test_index/test_models/_refresh' -d '{}'
curl -XGET 'http://localhost:9200/test_index/_mapping'
curl -XGET 'http://localhost:9200/test_index/test_models/_search' -d '{"query":{"match_all":{}},"size":10}'
Run Code Online (Sandbox Code Playgroud)
这个问题也被发布到(超级棒)ElasticSearch邮件列表中:
https://groups.google.com/forum/?fromgroups#!topic/elasticsearch/Nxv0XpLDY4k
-DK