我正在为app引擎数据存储寻找替代库,它将执行最近n或盒装地理查询,目前我正在使用GeoModel 0.2并且运行速度非常慢(在某些情况下> 1.5秒).有没有人有什么建议?
谢谢!
python gis google-app-engine geohashing google-cloud-datastore
我现在拥有的是两个双重的filds:
<field name="x_geo_x_coordinate" type="double" indexed="true" stored="true" default="0"/>
<field name="x_geo_y_coordinate" type="double" indexed="true" stored="true" default="0"/>
Run Code Online (Sandbox Code Playgroud)
和我想要的:一个位置字段中的2个双精度值:
<field name="x_geo" type="location" indexed="true" stored="true" default="0.0,0.0"/>
Run Code Online (Sandbox Code Playgroud)
到目前为止我尝试了什么并且不起作用:
<copyField source="*_coordinate" dest="x_geo"/>
<copyField source="x_geo_str" dest="x_geo"/>
Run Code Online (Sandbox Code Playgroud)
有什么简单的解决 提前致谢!
我正在尝试开发一个基于地图的可视化,其中包含一个子群体的"热图",基于包含以下文档的MongoDB集合:
{
"PlaceName" : "Boston",
"Location" : {
"type" : "Point",
"coordinates" : [ 42.358056, -71.063611 ]
},
"Subpopulations": {
"Age": {
"0_4" : 37122,
"6_11" : 33167,
"12_17" : 35464,
"18_24" : 130885,
"25_34" : 127058,
"34_44" : 79092,
"45_54" : 72076,
"55_64" : 59766,
"65_74" : 33997,
"75_84" : 20219,
"85_" : 9057
}
}
}
Run Code Online (Sandbox Code Playgroud)
数据库中有数十万个单独的位置.它们不重叠 - 即"纽约市"和"曼哈顿"不会有两个单独的条目.
目标是使用Leaflet.js和一些插件来呈现此数据的各种可视化.Leaflet非常擅长聚类数据客户端 - 所以如果我通过密度值传递了千个位置,它可以通过处理所有单个值来渲染相关区域的热图.
问题是,我说缩小地图以显示整个世界.如果不是不可能的话,将所有数据发送到客户端并使其足够快地处理该信息以实现平滑可视化将是非常低效的.
所以我需要做的是自动集群数据服务器端,我希望可以在MongoDB查询中完成.我已经读过,geohashing可能是确定哪些点属于哪些集群的一个很好的起点,但我确信有人之前已经完成了这个问题并且可能有更好的洞察力.理想情况下,我想向我的node.js脚本发送一个查询,如下所示:
http://myserver.com/popdata?top=42.48&left=-80.57&bottom=37.42&right=-62.55&stat=Age&value=6_11
Run Code Online (Sandbox Code Playgroud)
这将根据要返回的数据点的最大数量或沿着这些线的某些内容,根据指定地理区域内有多少个点来确定聚类需要多少粒度; 它将返回如下数据:
[
{ "clusterlocation": [ 42.304, -72.622 ], …Run Code Online (Sandbox Code Playgroud) 我刚刚在我的应用程序中实现了Sunspot gem,我非常喜欢它,除了我在进行位置搜索时似乎排除了一些结果.例如:我住在哥伦比亚俄亥俄州,所以如果我搜索"哥伦布俄亥俄州"我的应用程序将其转换为lat/lng我做:
@search = (Skatepark.search {
with(:coordinates).near lat, lng, :precision => 3
fulltext text
paginate :page => params[:page], :per_page => 15
})
Run Code Online (Sandbox Code Playgroud)
这会返回一些在哥伦布西侧进行地理编码的记录,但不会记录我在我的数据库中位于东侧的记录.我在搜索时做错了什么?
您可以在http://skateparks.co/search上亲自试用
如果你搜索"哥伦布俄亥俄州",你会得到完全不同的结果,如果你搜索"兰卡斯特俄亥俄州",这只是东南部几英里.
我有一个如下所示的 Java 类(GeoPoint 是 Elasticsearch 类型):
private Long id;
private Integer genre;
private String cityName;
private GeoPoint geoPoint;
private Date lastUpdate;
private Double lat;
private Double lon;
Run Code Online (Sandbox Code Playgroud)
我使用的 Elasticsearch 映射是:
{
"location": {
"properties": {
"id": {"type": "long"},
"genre": {"type": "integer"},
"cityName": {"type": "string"},
"geoPoint": {
"type": "geo_point",
"geohash": true,
"geohash_prefix": true,
"geohash_precision": 7
},
"lastUpdate": {"type": "date", format: "yyyy/MM/dd HH:mm:ss"}
}
}
}
Run Code Online (Sandbox Code Playgroud)
尝试对其进行索引时,出现以下异常:
org.elasticsearch.ElasticsearchParseException:字段必须是纬度/经度或 geohash
异常是从GeoUtils 类的第 381 行抛出的。它发生在检查映射类中的 Double lat 和 lon 字段之后,就像 GeoPoint 属性一样。 …
我正在尝试将编码功能应用于数据帧。我不断遇到 ValueError:
>>> import pandas as pd
>>> import pygeohash as gh
>>> data = { 'latitude': [4.123, 24.345, 31.654], 'longitude': [25.432, 4.234, 57.098]}
>>> df = pd.DataFrame(data)
>>> df
latitude longitude
0 4.123 25.432
1 24.345 4.234
2 31.654 57.098
>>> df['geohash']=df.apply(lambda x: gh.encode(df.latitude, df.longitude, precision=5), axis=1)
Traceback (most recent call last):
.........
ValueError: ('The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().', 'occurred at index 0')
>>>
Run Code Online (Sandbox Code Playgroud)
放入一对值:
>>> gh.encode(22,36, precision = …Run Code Online (Sandbox Code Playgroud) Has anyone had any luck in importing data that has Geohash as a field into QGIS for any visualizations?
Ultimately my data is -
Name, Geohash, Value
Bob, 9mu9ecy, 3
Nancy, 9mu9ecy, 8
Nancy, 9mu9eff, 5
Tom, 9mu9ege, 5
Bob, 9mu9ege, 5
Mike, 9mu9emx, 8
Tom, 9mu9ep3, 7
Nancy, 9mu9epf, 2
Nancy, 9mu9epp, 4
...
Run Code Online (Sandbox Code Playgroud)
And I want to be able to create heatmaps and differential analysis with it.
Any help would be much appreciated.
我正在构建一个像 Uber eats 这样的订餐应用程序。所以,我正在使用 flutter 制作一个应用程序,但是现在我遇到了寻找最近的餐馆的问题。
我目前正在使用 geoflutterfire 包存储位置详细信息。请参阅附图。

看看我的代码。
getLocation() async {
// Create a geoFirePoint
GeoFirePoint center =
geo.point(latitude: 28.706707247639613, longitude: 80.58572410373661);
// get the collection reference or query
var collectionReference = _firestore.collection('locations');
double radius = 5;
String field = 'position';
Stream<List<DocumentSnapshot>> stream = geo
.collection(collectionRef: collectionReference)
.within(center: center, radius: radius, field: field);
stream.forEach((element) {
element.forEach((e) {
double fbLat = e.get('position')['geopoint'].latitude;
double fbLng = e.get('position')['geopoint'].longitude;
LatLng loc2 = LatLng(fbLat, fbLng);
LatLng loc1 = LatLng(center.latitude, center.longitude);
final distance = …Run Code Online (Sandbox Code Playgroud) 两个geohash,前6个字符匹配,两个geohash之间的距离最大为0.61km两个geohash,前5个字符匹配,两个geohash之间的距离最大为2.5km
问:给定5个数字长度的geohash的任何一对边界框之间的最大距离(近似值)是多少
我一直在寻找一种有效的方法来在Python中将一组geohash转换为多边形,此外有时我会获得多重多边形而不是多边形,可能是因为一些内部geohash丢失了。我目前正在使用python-geohash和shapely,我的方法包括以下步骤:
我通过提取每个 geohash 的角坐标将其转换为多边形。
def to_polygon(geohash):
box = Geohash.bbox(geohash)
return Polygon([(box['e'], box['n']), (box['w'], box['n']), (box['w'], box['s']), (box['e'], box['s'])])
Run Code Online (Sandbox Code Playgroud)然后我map对iterablegeohashes 执行前面解释的转换。
polygons = [to_polygon(geohash) for geohash in geohashes]
Run Code Online (Sandbox Code Playgroud)最后,我使用多边形的方法union将所有这些多边形合并为一个多边形。
polygon = functools.reduce(lambda a, b: a.union(b), polygons)
Run Code Online (Sandbox Code Playgroud)如果一组 geohashes 约为数千,则可能需要几分钟。
geohashing ×10
geolocation ×2
python ×2
python-3.x ×2
dih ×1
firebase ×1
flutter ×1
geospatial ×1
gis ×1
leaflet ×1
mongodb ×1
node.js ×1
pandas ×1
polygons ×1
qgis ×1
search ×1
solr ×1