我無法使用json.load()
加載我的json
文件。我的格式是geojson
用下面的例子格式:geoJson:Json.load()ValueError:預計屬性名稱:第2行第9列
{ "type" : "Feature Collection",
{"features" : [
{ "type" : "Feature",
"id" : "FORT_1",
"geometry" : {
"type" : "Point",
"coordinates" : ["121.046859", "14.54544278"]},
"properties" : { "name" : "City"}
},
{ "type" : "Feature",
"id" : "FORT_2",
"geometry" : {
"type" : "Point",
"coordinates" : ["121.0500991", "14.54973692"]},
"properties" : { "name" : "One"}
},
我想測試一下使用下面的代碼,因爲他們知道這將創建一個dict
:
with open(geojsonFilePath) as file:
jsonFile = json.load(file)
for feature in jsonFile['features']:
print (['id'])
print (['geometry'],['type'])
print (['geometry'],['coordinates'])
print (['properties'],['name'])
但是在出現錯誤線jsonFile = json.load(file)
什麼是「FORT_1」和「FORT_2」?你的json對那些無效 –
@MosesKoledoye hangon讓我檢查我的模板並重試。儘管錯誤指出了@ {「features」:{放置的位置。 – Reiion
@MosesKoledoye無論如何我重新檢查它有相同的錯誤 – Reiion