- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.geotools.ysld.YamlUtil
类的一些代码示例,展示了YamlUtil
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlUtil
类的具体详情如下:
包路径:org.geotools.ysld.YamlUtil
类名称:YamlUtil
[英]Factory for Yaml instances.
[中]
代码示例来源:origin: geotools/geotools
public static Yaml getSafeYaml() {
return getSafeYaml(new DumperOptions());
}
代码示例来源:origin: geotools/geotools
public static Yaml getSafeYaml(DumperOptions dumperOptions) {
return getSafeYaml(new Representer(), dumperOptions);
}
代码示例来源:origin: geotools/geotools
/**
* Yaml representation.
*
* @return Yaml representation
*/
@Override
public String toString() {
StringWriter w = new StringWriter();
DumperOptions dumperOpts = new DumperOptions();
dumperOpts.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
dumperOpts.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN);
YamlUtil.getSafeYaml(dumperOpts).dump(raw, w);
return w.toString();
}
}
代码示例来源:origin: geotools/geotools
/**
* Encode the passed {@link StyledLayerDescriptor} as YSLD.
*
* @param sld
* @throws IOException
*/
public void encode(StyledLayerDescriptor sld) throws IOException {
DumperOptions dumpOpts = new DumperOptions();
dumpOpts.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Yaml yaml = YamlUtil.getSafeYaml(new YsldRepresenter(uomMapper), dumpOpts);
yaml.dumpAll(new RootEncoder(sld), out);
}
}
代码示例来源:origin: geotools/geotools
/**
* Parse the yaml provided to this instance using the provided {@link YamlParseHandler}.
*
* @param root The {@link YamlParseHandler} that handles the root of the parsed {@link
* YamlObject}.
* @param hints
* @return The root {@link YamlParseHandler}, once it has finished handling the parsed {@link
* YamlObject}..
* @throws IOException
*/
@SuppressWarnings("PMD.EmptyWhileStmt")
public <T extends YamlParseHandler> T parse(T root, Map<String, Object> hints)
throws IOException {
Object parsed = YamlUtil.getSafeYaml().load(yaml);
YamlParseContext context = new YamlParseContext();
context.mergeDocHints(hints);
context.push(YamlObject.create(parsed), root);
while (context.next()) ;
return root;
}
}
代码示例来源:origin: geotools/geotools
YamlMap yaml(SldTransformer transformer) throws Exception {
String yaml = ((StringWriter) transformer.context().output()).toString();
return new YamlMap(YamlUtil.getSafeYaml().load(yaml));
}
代码示例来源:origin: geotools/geotools
@Test
public void testFTSVendorOption() throws Exception {
PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer();
FeatureTypeStyle fts = fts(p);
fts.getOptions().put("foo", "bar");
StringWriter out = new StringWriter();
Ysld.encode(sld(fts), out);
System.out.append(out.toString());
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result = obj.seq("feature-styles").map(0);
assertThat(result.str("x-foo"), equalTo("bar"));
}
代码示例来源:origin: geotools/geotools
YamlMap encode(String dirname, String filename) throws Exception {
SLDParser sldParser = new SLDParser(CommonFactoryFinder.getStyleFactory());
sldParser.setInput(YsldTests.sld(dirname, filename));
StyledLayerDescriptor sld = sldParser.parseSLD();
StringWriter w = new StringWriter();
YsldEncoder ysldEncoder = new YsldEncoder(w, new UomMapper());
ysldEncoder.encode(sld);
// System.out.println(w.toString());
return new YamlMap(YamlUtil.getSafeYaml().load(new StringReader(w.toString())));
}
}
代码示例来源:origin: geotools/geotools
for (Event evt : YamlUtil.getSafeYaml().parse(input)) {
YsldValidateHandler h = context.peek();
代码示例来源:origin: geotools/geotools
@Test
public void testSymbolizerVendorOption() throws Exception {
PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer();
FeatureTypeStyle fts = fts(p);
p.getOptions().put("foo", "bar");
StringWriter out = new StringWriter();
Ysld.encode(sld(fts), out);
System.out.append(out.toString());
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("point");
assertThat(result.str("x-foo"), equalTo("bar"));
}
代码示例来源:origin: geotools/geotools
@Test
public void testSymbolizerUoMMetre() throws Exception {
PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer();
FeatureTypeStyle fts = fts(p);
p.setUnitOfMeasure(UomOgcMapping.METRE.getUnit());
StringWriter out = new StringWriter();
Ysld.encode(sld(fts), out);
System.out.append(out.toString());
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("point");
assertThat(result.str("uom"), equalTo("metre"));
}
代码示例来源:origin: geotools/geotools
@Test
public void testSymbolizerUoMPixel() throws Exception {
PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer();
FeatureTypeStyle fts = fts(p);
p.setUnitOfMeasure(UomOgcMapping.PIXEL.getUnit());
StringWriter out = new StringWriter();
Ysld.encode(sld(fts), out);
System.out.append(out.toString());
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("point");
assertThat(result.str("uom"), equalTo("pixel"));
}
代码示例来源:origin: geotools/geotools
@Test
public void testSymbolizerUoMFoot() throws Exception {
PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer();
FeatureTypeStyle fts = fts(p);
p.setUnitOfMeasure(UomOgcMapping.FOOT.getUnit());
StringWriter out = new StringWriter();
Ysld.encode(sld(fts), out);
System.out.append(out.toString());
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("point");
assertThat(result.str("uom"), equalTo("foot"));
}
代码示例来源:origin: geotools/geotools
@Test
public void testFilter() throws Exception {
FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2();
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
UserLayer layer = styleFactory.createUserLayer();
sld.layers().add(layer);
Style style = styleFactory.createStyle();
layer.userStyles().add(style);
Rule rule = styleFactory.createRule();
rule.setFilter(filterFactory.less(filterFactory.property("foo"), filterFactory.literal(2)));
style.featureTypeStyles().add(styleFactory.createFeatureTypeStyle());
style.featureTypeStyles().get(0).rules().add(rule);
PointSymbolizer p = styleFactory.createPointSymbolizer();
rule.symbolizers().add((Symbolizer) p);
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result = obj.seq("feature-styles").map(0).seq("rules").map(0);
assertThat(result, yHasEntry("filter", equalTo("${foo < 2}")));
}
代码示例来源:origin: geotools/geotools
@Test
public void testEmptyColorMap() throws Exception {
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = sld(styleFactory.createRasterSymbolizer());
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap symbMap =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("raster");
assertThat(symbMap, not(yHasEntry("color-map")));
}
代码示例来源:origin: geotools/geotools
@Test
public void testFilterEscape() throws Exception {
FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2();
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
UserLayer layer = styleFactory.createUserLayer();
sld.layers().add(layer);
Style style = styleFactory.createStyle();
layer.userStyles().add(style);
Rule rule = styleFactory.createRule();
rule.setFilter(
filterFactory.less(filterFactory.property("foo"), filterFactory.literal("}$")));
style.featureTypeStyles().add(styleFactory.createFeatureTypeStyle());
style.featureTypeStyles().get(0).rules().add(rule);
PointSymbolizer p = styleFactory.createPointSymbolizer();
rule.symbolizers().add((Symbolizer) p);
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result = obj.seq("feature-styles").map(0).seq("rules").map(0);
assertThat(result, yHasEntry("filter", equalTo("${foo < '\\}\\$'}")));
}
代码示例来源:origin: geotools/geotools
@Test
public void testNonNameExpressionAttribute() throws Exception {
PointSymbolizer p = CommonFactoryFinder.getStyleFactory().createPointSymbolizer();
Expression expression = CommonFactoryFinder.getFilterFactory2().property("test");
p.setGeometry(expression);
StringWriter out = new StringWriter();
Ysld.encode(sld(p), out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
String result =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("point")
.str("geometry");
assertThat(result, equalTo("${test}"));
}
代码示例来源:origin: geotools/geotools
@Test
public void testEmptyContrastEnhancement() throws Exception {
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = sld(styleFactory.createRasterSymbolizer());
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap symbMap =
obj.seq("feature-styles")
.map(0)
.seq("rules")
.map(0)
.seq("symbolizers")
.map(0)
.map("raster");
assertFalse(symbMap.has("contrast-enhancement"));
}
代码示例来源:origin: geotools/geotools
Ysld.encode(sld, out);
YamlMap yaml = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
代码示例来源:origin: geotools/geotools
@Test
public void testFunction() throws Exception {
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
UserLayer layer = styleFactory.createUserLayer();
sld.layers().add(layer);
Style style = styleFactory.createStyle();
layer.userStyles().add(style);
Rule rule = styleFactory.createRule();
style.featureTypeStyles().add(styleFactory.createFeatureTypeStyle());
style.featureTypeStyles().get(0).rules().add(rule);
Function func =
filterFactory.function(
"strEndsWith", filterFactory.property("foo"), filterFactory.literal("bar"));
rule.setFilter(filterFactory.equal(func, filterFactory.literal(true), false));
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
String filter = obj.seq("feature-styles").map(0).seq("rules").map(0).str("filter");
assertEquals("${strEndsWith(foo,'bar') = true}", filter);
}
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 我们不允许提问寻求书籍、工具、软件库等的推荐。您可以编辑问题,以便用事实和引用来回答。 关闭 4 年前。
我也是 Geotools 和 Maven 的新手。我尝试了快速入门来开始使用地理工具,一切都运行良好,直到我尝试创建示例应用程序。所有以 org.geotools 开头的导入都被标记为不存在。查找依赖
我目前正在使用 GeoTools 工具包对海洋船只数据进行计算,例如计算两个经/纬度点之间的大圆距离。我还有两个需要满足的其他要求,但我不确定在 GeoTools 中的什么地方可以找到执行此类计算的类
我正在研究一个Java项目,该项目需要将WGS84转换为UMT。我使用geotools v20.5通过以下代码创建了一个转换: transform = CRS.findMathTransform(
有人可以告诉我如何通过 java geotools api 获取特征的顶点吗? 就我而言,我在postgis中有一个多边形层,我可以查询该层的所有特征,并且我需要知道每个特征的顶点。
我正在使用 geotools.js 将操作系统网格引用转换为纬度和经度。不幸的是,默认情况下(我相信)输出限制为小数点后两位。为了更准确的读数,我需要它是小数点后 5 位。 我尝试在自己的代码中删除对
我正在使用 geotools 库。我的目标是输入一个坐标,然后获取包含它的要素信息。 Geotools Quickstart 教程的 map 完全按照我想要的方式使用我在下面用红色圈出的按钮。但是,我
我正在使用 GeoTools Java 库进行一些几何计算。就我而言,我使用的是一个形状文件,其中包含某个城市的所有邻域多面体。我想知道那个城市的每一个可能的坐标,它对应于哪个街区。所以我的方法是简单
我正在使用 Java Geotools 库来检查 POINT(...) 是否包含在 POLYGON(...) 中。 我已经完成了: Geometry sPG = reader.read(wktStar
本文整理了Java中org.geotools.util.WeakCollectionCleaner类的一些代码示例,展示了WeakCollectionCleaner类的具体用法。这些代码示例主要来源于
本文整理了Java中org.geotools.resources.XArray类的一些代码示例,展示了XArray类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Mave
本文整理了Java中org.geotools.resources.XMath类的一些代码示例,展示了XMath类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等
本文整理了Java中org.geotools.xs.XSSchema类的一些代码示例,展示了XSSchema类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平
本文整理了Java中org.geotools.ysld.Ysld类的一些代码示例,展示了Ysld类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些
本文整理了Java中org.geotools.ysld.YamlSeq类的一些代码示例,展示了YamlSeq类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平
本文整理了Java中org.geotools.ysld.YamlUtil类的一些代码示例,展示了YamlUtil类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven
关闭。这个问题是opinion-based .它目前不接受答案。 想改善这个问题吗?更新问题,以便可以通过 editing this post 用事实和引文回答问题. 6 个月前关闭。 Improve
我正在实现轨迹点的插值。所以,基本上,我需要沿着从起点到终点的方位角创建几个点。问题是,我无法将创建的点添加到集合中: SimpleFeatureType featureType = featureS
我有很多点导致 getOrthodromicDistance 方法在 geotools lib 中失败并出现异常,而这些点是有效的经纬度点: 抛出异常的点(纬度,经度): val p1= (5.318
我是一名优秀的程序员,十分优秀!