目前,我允许用户使用绘图层绘制ESRI传单地图,向该层添加一些附加属性,然后将结果提交给功能服务。
这对于单个多边形来说是很棒的。然而,这种方法不适用于多部分(多多边形)多边形,也不适用于FeatureCollection中的混合特征类型。我特别希望提交多部分多边形,而不是迭代可用的功能。地理信息系统的一些功能依赖于它们是多部分的。
下面是我目前处理事情的一个样本集。然后,我想到了一个关于多部分的概念。
我的问题是-
在使用geojsonToArcGIS时,我可以使用addFeature的结果将多部分多边形添加到功能服务中吗?
我不仅不知道这是否是一个有效的方法,我也不确定是否有更好的方法来解决这个问题。在使用ESRI传单添加多部分功能集合时,没有太多的文档或示例可供在线使用。
目前使用:
var feature = {
type: 'Feature',
geometry: Geometry,
properties: {
LGA: String(lga),
Locality: String(locality),
Region: String(region),
};
service.addFeature(feature, function (error, response) {
if (error) {
console.log('error creating feature' + error.message);
} else {
console.log('Successfully created feature with id ' + response.objectId);
}
});与其使用上面的内容,我想知道是否有可能按照以下方式来做更多的事情:
//We start with a drawing layer, ingested as drawngeo. Lets assume it has 3 polygons (or lines) at this point.
if (eventtype == "create") {
var drawngeo = drawnItems.toGeoJSON(); //This makes the JSON accessible
drawngeo.features[0].properties.TestKey = "Test"; //Add a custom property, for example.
var drawnesrijson = L.esri.Util.geojsonToArcGIS(drawngeo,"OBJECTID"); //Make it ESRI-JSON
}
service.addFeature(drawnesrijson, function (error, response) { //We have used the ESRI GeoJSON instead
if (error) {
console.log('error creating feature' + error.message);
} else {
console.log('Successfully created feature with id ' + response.objectId);
}
});如果这有助于人们在未来发现这一点,以下是一些额外的关键字: ArcGIS Online、AGOL、ESRI、ArcGIS Portal。
发布于 2021-02-10 18:00:49
ArcGIS Rest使用EsriJson和GeoJson支持多部分多边形。您使用的库看起来是相同的从埃斯里来的,应该能够转换为多部分,但如果不是,那么您可能需要自己构造对象,就像在第一个示例中所做的那样。
下面是一个用几何学构造成多部分多边形的示例EsriJson对象:
{
"attributes" : {
"DESCRIPTION" : "Test case multipolygon"
},
"geometry" :
{
"rings" :
[
[
[155000, 463000],
[156000, 463000],
[156000, 464000],
[155000, 464000],
[155000, 463000]
],
[
[157000, 463000],
[158000, 463000],
[158000, 464000],
[157000, 464000],
[157000, 463000]
]
]
}
}
对绞股蓝()的输出执行console.log()并检查Json数组是否与上面的格式匹配可能是有帮助的。如果没有,则需要检查输入是否有效(没有甜甜圈或重叠几何图形),或者构造几何学以匹配多部分的EsriJson格式,然后像上面的示例1一样将其附加到Json对象中。
https://stackoverflow.com/questions/66135426
复制相似问题