Gui*_*gas 3 gis google-bigquery
我一直在尝试在 BigQuery 中加载多边形数据,但似乎不起作用。
有没有更简单的方法在 BigQuery 中上传多边形数据?
设法找到一个简单的解决方案!:)
# First, I convert the shapefile to a geojson:
ogr2ogr -f GeoJSON -t_srs crs:84 data/poligonos_setores_censitarios.geojson data/pr_setores_censitarios
# After, since BigQuery demands json and geojson files to be newline delimited, I modify it a bit:
cat data/poligonos_setores_censitarios.geojson | jq -c ".features[]" > data/poligonos_setores_censitarios_newlinedelimited.geojson
# Then, I upload it to Google Cloud Storage:
gsutil cp data/poligonos_setores_censitarios_newlinedelimited.geojson gs://cloud-storage-bucket01/
# And finally, load it in BigQuery:
bq load --source_format=NEWLINE_DELIMITED_JSON --json_extension=GEOJSON --autodetect mydataset.polygons gs://cloud-storage-bucket01/poligonos_setores_censitarios_newlinedelimited.geojson
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
885 次 |
| 最近记录: |