Мне удалось создать FeatureSet с нуля и добавить его на карту, а затем опубликовать ... ну вроде ... линии не отображаются.Чего мне не хватает в опубликованном наборе, который не отображается?
Я пытался опубликовать файл CSV, чтобы получить очки.Что мне нужно, это линии между некоторыми точками.Итак, я создал пару линий поли и добавил их к объекту, который я поместил в слой на карте.
Затем я опубликовал слой и карту.Ни визуализируется на карте, ни при добавлении в качестве слоя.
from arcgis.gis import GIS
gis = GIS("https://www.arcgis.com", "myusername", "mypasswd")
import json
import arcgis.geometry as gm
import arcgis.features as features
line = {
"paths" : [
[[-97.0000,32.0000],[-98.0000,32.000],[-98.0000,31.0000],[-97.0000,31.00000]],
[[-97.06326,32.759],[-97.06298,32.755]]],
"spatialReference" : {"wkid" : 3857}
}
p1 = gm.Polyline(line)
line = {
"paths" : [[[-97.06138,32.837],[-97.06133,32.836],[-97.06124,32.834],[-97.06127,32.832]],
[[-97.06326,32.759],[-97.06298,32.755]]],
"spatialReference" : {"wkid" : 3857}
}
p2 = gm.Polyline(line)
# wkid could be 4326??
F1 = features.Feature(geometry=p1)
F2 = features.Feature(geometry=p2)
fc_prop = { 'title' : 'Random Square' , 'type': 'Feature Collection' }
FL = features.FeatureLayer("my-url-to-existing-layer")
FSet = features.FeatureSet(features=[F1,F2] , geometry_type = 'Polyline')
map1 = gis.map('USA')
map1.add_layer(FSet, { "renderer" : "ClassedSizeRenderer", } )
ly = map1.layers[0]
item_properties = {
"title": "This 3857 Aint Right",
"tags" : "oil,gas,wells,roses",
"description" : "...from simple layer....",
"type": "Feature Collection",
"typeKeywords": "Data, Feature Collection",
}
# ly.layer.layers[0].layerDefinition.drawingInfo.renderer.symbol
item_properties['text'] = json.dumps({'featureCollection': dict(ly.layer) })
item = gis.content.add(item_properties)
gis.content.share_items(item, everyone=True)
# Saves a map
ip= { 'title': "another layer" , 'snippet': "added polygon", 'tags': "some,ting,wong" }
map1.save(ip)
---
I get no errors from the calls - the FeatureLayer shows up in my GIS account but does not render.
I have dumped the layer that I am publishing as a JSON object.
---json
{
"layers": [
{
"featureSet": {
"geometryType": "Polyline",
"features": [
{
"geometry": {
"paths": [
[
[
-97.0,
32.0
],
[
-98.0,
32.0
],
[
-98.0,
31.0
],
[
-97.0,
31.0
]
],
[
[
-97.06326,
32.759
],
[
-97.06298,
32.755
]
]
],
"spatialReference": {
"wkid": 3857
}
},
"attributes": {
"OBJECTID": 1
}
},
{
"geometry": {
"paths": [
[
[
-97.06138,
32.837
],
[
-97.06133,
32.836
],
[
-97.06124,
32.834
],
[
-97.06127,
32.832
]
],
[
[
-97.06326,
32.759
],
[
-97.06298,
32.755
]
]
],
"spatialReference": {
"wkid": 3857
}
},
"attributes": {
"OBJECTID": 2
}
}
]
},
"layerDefinition": {
"geometryType": "Polyline",
"fields": [
{
"name": "OBJECTID",
"type": "esriFieldTypeOID",
"alias": "OBJECTID",
"sqlType": "sqlTypeOther"
}
],
"objectIdField": "OBJECTID",
"type": "Feature Layer",
"drawingInfo": {
"renderer": {
"type": "simple",
"symbol": "circle"
}
}
}
}
]
}
---