2017-10-11 92 views
0

我已經用SQL將數據庫中的一些興趣點生成爲geoJSON。如何導入GeoJSON文件以用於Google地球引擎代碼編輯器?

以GeoJSON:

{ 
    "FeatureCollection" : [ 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.927083, 
        -12.260889 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "626.46" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.916500, 
        -12.255944 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "565.04" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.949417, 
        -12.270361 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "631.47" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.958833, 
        -12.277361 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "591.85" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.942944, 
        -12.249889 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "644.67" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.930917, 
        -12.243611 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "644.67" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.871917, 
        -12.197139 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.866861, 
        -12.206417 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.967389, 
        -12.261889 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "592.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.973500, 
        -12.250639 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "592.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.962944, 
        -12.245444 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "621.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.952667, 
        -12.239778 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "592.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.931639, 
        -12.228528 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.908694, 
        -12.247472 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "557.20" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.918667, 
        -12.239139 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "644.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.897028, 
        -12.246000 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "557.20" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.906417, 
        -12.230472 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "64.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.895750, 
        -12.225028 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "644.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.927111, 
        -12.213750 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "564.90" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.917639, 
        -12.208750 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "564.90" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.897833, 
        -12.198444 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "584.00" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.881583, 
        -12.202233 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.876833, 
        -12.235306 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.867278, 
        -12.230306 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.856806, 
        -12.224889 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.861806, 
        -12.215611 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.887833, 
        -12.192806 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "12.60" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.877639, 
        -12.187917 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "564.90" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.941889, 
        -12.234611 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "644.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.887111, 
        -12.239889 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "644.50" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.907944, 
        -12.203361 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "591.70" 
      }, 
      "type" : "Feature" 
     }, 
     { 
      "geometry" : { 
       "coordinates" : [ 
        -45.892722, 
        -12.208028 
       ], 
       "type" : "Point" 
      }, 
      "properties" : { 
       "grower" : "foo", 
       "name" : "bar", 
       "radius" : "574.60" 
      }, 
      "type" : "Feature" 
     } 
    ] 
} 

我想這GeoJSON的導入到谷歌地球引擎我的代碼編輯器。查看文檔(assets manager),GEE接受資產作爲柵格圖像,shapefile(.shp,shx,dbf,prj)。

此外,我發現通過融合表導入特徵集合,但它仍然需要shapefile。

我發現一些geojson shapefile轉換器,但我需要一種方法來直接將我的geojson導入到GEE上的功能集合。那可能嗎?

+0

您不能使用代碼編輯器,但可以使用Python API來執行某些解決方法。提取數據並創建* ee.Geometry.Point *對象,執行您所需要的任何操作(圖像處理)並獲取結果 –

+0

您推薦處理GeoJSON的任何python庫? –

回答

0

您可以使用OGR輕鬆地將您的數據轉換成shapefile(您可以通過代碼編輯器上傳)或KML上傳到FusionTables中。

ogr2ogr -f KML output.kml input.json 

但是,你的FeatureCollection是無效的GeoJSON,你必須先解決這個問題。序言應該如下所示:

{ 
    "type": "FeatureCollection", 
    "features": [ 
     { 
      "geometry" : { ... 
相關問題