How to use tag filtering in Atlas

故事扮演 提交于 2020-01-06 04:53:08

问题


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);

回答1:


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).

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 -> ...);


来源:https://stackoverflow.com/questions/56188230/how-to-use-tag-filtering-in-atlas

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!