Indexing RavenDB空间索引未建立
我已经成功地将geodata导入到一个名为AdministrativeArea的类中,其中包括一个WKT字段。此字段包含长度和纬度的多边形坐标点。我已将其声明为字符串。 我想查询文档,找出给定边框中包含哪些多边形/地理区域。为此,我使用空间特征创建了一个索引。 这个索引或我构建它的方式似乎有点“关闭”:要么索引计数停留在0上,什么也没有发生,要么它开始构建,但停留在一个随机数上,我收到一条错误消息。有人能帮忙吗 谢谢 代码/错误消息:Indexing RavenDB空间索引未建立,indexing,geocoding,ravendb,Indexing,Geocoding,Ravendb,我已经成功地将geodata导入到一个名为AdministrativeArea的类中,其中包括一个WKT字段。此字段包含长度和纬度的多边形坐标点。我已将其声明为字符串。 我想查询文档,找出给定边框中包含哪些多边形/地理区域。为此,我使用空间特征创建了一个索引。 这个索引或我构建它的方式似乎有点“关闭”:要么索引计数停留在0上,什么也没有发生,要么它开始构建,但停留在一个随机数上,我收到一条错误消息。有人能帮忙吗 谢谢 代码/错误消息: "WKT": "POLYGON ((21.751548767
"WKT": "POLYGON ((21.7515487670898 62.0147895812988,21.7420005798341 62.0149002075195, etc. etc.
public class AdministrativeArea_ByNameAndWKT : AbstractIndexCreationTask<AdministrativeArea>
{
public AdministrativeArea_ByNameAndWKT()
{
Map = AdministrativeAreas => from a in AdministrativeAreas
select new
{
Name = a.NAME_1,
WKT = a.WKT
};
Spatial(x => x.WKT, options => options.Geography.Default());
}
}
Failed to load routed module (viewmodels/database/status/indexing/indexStats). Details: Load timeout for modules: d3/d3
…和一个JSON示例(其中约有260.000个…)
顺便说一句:在260.000个区域中,每个区域内都有数百个(如果不是数千个的话)lat/lng点(出于空间原因,我在上面的示例中截断了大约90%的坐标…)。也许我的方法不适合这个案子
RavenDB索引行为在这方面非常奇怪:它似乎在索引任务上“卡住了”(CPU在20%到40美元之间,RAM消耗持续但缓慢地增加),但没有创建新的索引项,也没有出现错误消息。我在一台16GB内存的笔记本电脑和一台~3.6GHz的i7上运行这个 这就是你的形状 问题是这个形状长约5公里,宽600-700米,而且没有很好地对齐。 我们的默认精度模式设置为5米左右,这意味着我们需要有效地绘制一个由许多5米小片组成的形状,粗略估计大约为350K 要么简化形状,要么降低精度 您可以在这里看到关于空间精度的文档:
请将完整数据发布到您的实际文档中。@Ayendrahien我已经更新了描述。好吧,也许我严重低估了这个地理数据索引任务的计算资源需求:它确实在进展,但速度慢得令人难以置信。我想这是可以理解的,因为它必须为数百万个lat lng坐标点构建一个散列(它实际上就是这样做的吗?)@AyendeRahien你有没有任何-甚至是远程-可比的性能统计数据,这样我就可以知道如何解决这个问题了?如果答案是:你的笔记本电脑需要2个月的时间,我必须考虑其他选项:-谢谢你的澄清。我开始明白这里到底需要多少计算。260.000个地理区域,由350.000个5m块组成。但至少我现在明白了背后的动力。形状“奇怪”的原因是,为了简洁起见,我特意“剪裁”了所有其他点,以便在stackoverflow上发布。最后两个问题:1)有没有办法告诉RavenDB当前的计算结果(日志?=>“(…)导致索引xyz给定文档(…)”)2)当我暂停并恢复索引时,它会丢失任何东西不,恐怕它不会报告它在单个索引项中所做的工作。是的,暂停/恢复将重置该文档的所有内容
IList<AdministrativeArea> results = session
.Query<AdministrativeArea, AdministrativeArea_ByNameAndWKT>()
.Spatial(x => x.WKT, criteria => criteria.WithinRadius(6.0, 0.24380, 6.636))
.ToList();
public class AdministrativeArea
{
public string WKT { get; set; }
public int OBJECTID { get; set; }
public float UID { get; set; }
public int ID_0 { get; set; }
public string ISO { get; set; }
public string NAME_0 { get; set; }
public int ID_1 { get; set; }
public string NAME_1 { get; set; }
public string VARNAME_1 { get; set; }
public string NL_NAME_1 { get; set; }
public string HASC_1 { get; set; }
public string CCN_1 { get; set; }
public string CCA_1 { get; set; }
public string TYPE_1 { get; set; }
public string ENGTYPE_1 { get; set; }
public string VALIDFR_1 { get; set; }
public string VALIDTO_1 { get; set; }
public string REMARKS_1 { get; set; }
public int? ID_2 { get; set; }
public string NAME_2 { get; set; }
public string VARNAME_2 { get; set; }
public string NL_NAME_2 { get; set; }
public string HASC_2 { get; set; }
public int CCN_2 { get; set; }
public string CCA_2 { get; set; }
public string TYPE_2 { get; set; }
public string ENGTYPE_2 { get; set; }
public string VALIDFR_2 { get; set; }
public string VALIDTO_2 { get; set; }
public string REMARKS_2 { get; set; }
public int ID_3 { get; set; }
public string NAME_3 { get; set; }
public string VARNAME_3 { get; set; }
public string NL_NAME_3 { get; set; }
public string HASC_3 { get; set; }
public int CCN_3 { get; set; }
public string CCA_3 { get; set; }
public string TYPE_3 { get; set; }
public string ENGTYPE_3 { get; set; }
public string VALIDFR_3 { get; set; }
public string VALIDTO_3 { get; set; }
public string REMARKS_3 { get; set; }
public int ID_4 { get; set; }
public string NAME_4 { get; set; }
public string VARNAME_4 { get; set; }
public int CCN_4 { get; set; }
public string CCA_4 { get; set; }
public string TYPE_4 { get; set; }
public string ENGTYPE_4 { get; set; }
public string VALIDFR_4 { get; set; }
public string VALIDTO_4 { get; set; }
public string REMARKS_4 { get; set; }
public int ID_5 { get; set; }
public string NAME_5 { get; set; }
public int CCN_5 { get; set; }
public string CCA_5 { get; set; }
public string TYPE_5 { get; set; }
public string ENGTYPE_5 { get; set; }
public string REGION { get; set; }
public string VARREGION { get; set; }
public float Shape_Leng { get; set; }
public float Shape_Area { get; set; }
}
{
"WKT": "POLYGON ((29.666404724121 -28.5651550292969,29.6635494232178 -28.5674591064453,29.6602096557618 -28.5701694488525,29.6568603515626 -28.5728702545166,29.6519393920898 -28.5768508911132,29.6490306854248 -28.5791893005371,29.6461200714112 -28.5815391540527,29.6373901367189 -28.58856010437,29.6344795227051 -28.5909099578857,29.6345596313476 -28.5909996032715,29.6346702575684 -28.5911197662353,29.6353797912599 -28.5918998718262,29.6361103057862 -28.5927104949951,29.6368408203124 -28.5935096740723,29.6375408172609 -28.5942897796631,29.6375904083253 -28.5943508148193,29.6382408142091 -28.5950794219971,29.6389408111573 -28.595890045166,29.6396198272705 -28.5966701507568,29.6403102874756 -28.5974502563476,29.6410102844238))",
"OBJECTID": 207648,
"UID": 20764800000000000,
"ID_0": 211,
"ISO": "ZAF",
"NAME_0": "South Africa",
"ID_1": 4,
"NAME_1": "KwaZulu-Natal",
"VARNAME_1": "Natal and Zululand",
"NL_NAME_1": "",
"HASC_1": "ZA.NL",
"CCN_1": 0,
"CCA_1": "KZN",
"TYPE_1": "Provinsie",
"ENGTYPE_1": "Province",
"VALIDFR_1": "Unknown",
"VALIDTO_1": "Present",
"REMARKS_1": "",
"ID_2": 27,
"NAME_2": "Uthukela",
"VARNAME_2": "",
"NL_NAME_2": "",
"HASC_2": "ZA.NL.UL",
"CCN_2": 0,
"CCA_2": "DC23",
"TYPE_2": "District Municipality",
"ENGTYPE_2": "District Municipality",
"VALIDFR_2": 2011,
"VALIDTO_2": "Current",
"REMARKS_2": "",
"ID_3": 108,
"NAME_3": "Okhahlamba",
"VARNAME_3": "",
"NL_NAME_3": "",
"HASC_3": "",
"CCN_3": 0,
"CCA_3": "KZN235",
"TYPE_3": "Local Municipality",
"ENGTYPE_3": "Local Municipality",
"VALIDFR_3": 2011,
"VALIDTO_3": "Current",
"REMARKS_3": "",
"ID_4": 2161,
"NAME_4": 13,
"VARNAME_4": "",
"CCN_4": 52305013,
"CCA_4": "",
"TYPE_4": "Ward",
"ENGTYPE_4": "Ward",
"VALIDFR_4": 2011,
"VALIDTO_4": "Current",
"REMARKS_4": "",
"ID_5": 0,
"NAME_5": "",
"CCN_5": 0,
"CCA_5": "",
"TYPE_5": "",
"ENGTYPE_5": "",
"REGION": "",
"VARREGION": "",
"Shape_Leng": 194782209549,
"Shape_Area": 6270373326
}