我正在动态创建地理服务器层,我想为它添加一些约束。我想要的约束CONSTRAINT enforce_dims_geom3 CHECK (st_ndims(geom) = 3)
我试着用
GSFeatureDimensionInfoEncoder dim3 = new GSFeatureDimensionInfoEncoder("ELE");
featureTypeEncoder.setMetadataDimension("elevation",dim3);
这根本不会影响结果。我该如何添加它?
修改
我正在使用GSAttributeEndcoder
GSAttributeEncoder attribute = new GSAttributeEncoder();
attribute.setAttribute(FeatureTypeAttribute.name, "geom");
attribute.setAttribute(FeatureTypeAttribute.minOccurs, String.valueOf(0));
attribute.setAttribute(FeatureTypeAttribute.maxOccurs, String.valueOf(1));
attribute.setAttribute(FeatureTypeAttribute.nillable, String.valueOf(true));
attribute.setAttribute(FeatureTypeAttribute.binding, "com.vividsolutions.jts.geom.Geometry");
featureTypeEncoder.setAttribute(attribute);
并以
发布GeoserverRestPublisher p = new GeoserverRestPublisher(stuff);
p.publishDBLayer(username, username, featureTypeEncoder, layerEncoder);