本文介绍了如何在Atlas中使用标签过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Atlas 项目(以及Java)的新手,我正在尝试一些方法.我正在寻找结合此处此处将标签过滤应用于Atlas.

New to the Atlas project (and also to Java), I am trying some things out. I am looking for the preferred way to combine the instructions given here and here to apply tag filtering on an Atlas.

下面是个好方法还是有更好的选择?

Would the below be a good approach or is there a better alternative?

String definition = "highway->residential";
final TaggableFilter filter = TaggableFilter.forDefinition(definition);
final Optional<Atlas> predicateAtlas = atlas.subAtlas(filter::test, AtlasCutType.SOFT_CUT);

推荐答案

您的代码将正常工作,并生成另一个Atlas,其中包含所有带有highway=residential的元素.重要的是要注意,Atlas必须遵循功能完整性(即Edge如果没有其结尾Node就不存在),这意味着某些没有您在此处指定的标记的功能可能仍会被拉入(连接的Node,或例如父级Relation.

Your code would work and produce an other Atlas that contains all elements with highway=residential. It is important to note that Atlas has to follow feature integrity (i.e. an Edge cannot exist without its end Nodes) which mean some features without the tag you specified here might still be pulled in (connected Nodes, or parent Relations for example).

仅获取标记为highway=residential的功能的另一种方法是不强制将其反馈给Atlas,而是仅打印或使用您选择的自定义功能进行处理:

Another way to only get the features that are tagged highway=residential would be to not force them to be fed back to an Atlas, but just printed, or handled with a custom function of your choice:

String definition = "highway->residential";
final TaggableFilter filter = TaggableFilter.forDefinition(definition);
atlas.entities(filter).forEach(entity -> ...);

这篇关于如何在Atlas中使用标签过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 17:01