我正在尝试使用tippecanoe生成MBTiles文件,首先我使用ogr2ogr将从Geofabric下载的形状文件转换为GeoJSON文件,然后使用tippecanoe将该GeoJSON文件转换为MBTiles文件。
我被卡住的步骤是这样的
ogr2ogr -f GeoJSON turk.geojson turkmenistan-latest-free.shp我从Geofabric下载的文件是一个.shp.zip文件- https://download.geofabrik.de/asia/turkmenistan-latest-free.shp.zip。在解压这个压缩文件时,我得到了一个文件夹,其中包含各种文件,如gis_osm_buildings_a_free_1.cpg等。但是,没有turkmenistan-latest-free.shp文件-或者一个包含所有etc的.shp文件。
当我直接在从.zip文件中解压出来的文件夹上运行ogr2ogr命令时,我得到这个错误
ERROR 1: Layer 'gis_osm_landuse_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Terminating translation prematurely after failed
translation of layer gis_osm_landuse_a_free_1 (use -skipfailures to skip errors)如果我用-skipfailures运行相同的命令,我会得到更多的错误
ERROR 1: Layer 'gis_osm_landuse_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_natural_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_natural_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_places_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_places_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_pofw_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_pofw_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_pois_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_pois_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_railways_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_roads_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_traffic_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_traffic_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_transport_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_transport_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_water_a_free_1' does not already exist in the output dataset, and cannot be created by the output driver.
ERROR 1: Layer 'gis_osm_waterways_free_1' does not already exist in the output dataset, and cannot be created by the output driver.然而,在检查文件夹时,所有这些文件都已经存在于其中,但ogr2ogr不知何故无法找到它。这些是文件夹中的文件
README gis_osm_natural_free_1.shp gis_osm_pofw_free_1.prj gis_osm_roads_free_1.dbf gis_osm_transport_free_1.cpg
gis_osm_buildings_a_free_1.cpg gis_osm_natural_free_1.shx gis_osm_pofw_free_1.shp gis_osm_roads_free_1.prj gis_osm_transport_free_1.dbf
gis_osm_buildings_a_free_1.dbf gis_osm_places_a_free_1.cpg gis_osm_pofw_free_1.shx gis_osm_roads_free_1.shp gis_osm_transport_free_1.prj
gis_osm_buildings_a_free_1.prj gis_osm_places_a_free_1.dbf gis_osm_pois_a_free_1.cpg gis_osm_roads_free_1.shx gis_osm_transport_free_1.shp
gis_osm_buildings_a_free_1.shp gis_osm_places_a_free_1.prj gis_osm_pois_a_free_1.dbf gis_osm_traffic_a_free_1.cpg gis_osm_transport_free_1.shx
gis_osm_buildings_a_free_1.shx gis_osm_places_a_free_1.shp gis_osm_pois_a_free_1.prj gis_osm_traffic_a_free_1.dbf gis_osm_water_a_free_1.cpg
gis_osm_landuse_a_free_1.cpg gis_osm_places_a_free_1.shx gis_osm_pois_a_free_1.shp gis_osm_traffic_a_free_1.prj gis_osm_water_a_free_1.dbf
gis_osm_landuse_a_free_1.dbf gis_osm_places_free_1.cpg gis_osm_pois_a_free_1.shx gis_osm_traffic_a_free_1.shp gis_osm_water_a_free_1.prj
gis_osm_landuse_a_free_1.prj gis_osm_places_free_1.dbf gis_osm_pois_free_1.cpg gis_osm_traffic_a_free_1.shx gis_osm_water_a_free_1.shp
gis_osm_landuse_a_free_1.shp gis_osm_places_free_1.prj gis_osm_pois_free_1.dbf gis_osm_traffic_free_1.cpg gis_osm_water_a_free_1.shx
gis_osm_landuse_a_free_1.shx gis_osm_places_free_1.shp gis_osm_pois_free_1.prj gis_osm_traffic_free_1.dbf gis_osm_waterways_free_1.cpg
gis_osm_natural_a_free_1.cpg gis_osm_places_free_1.shx gis_osm_pois_free_1.shp gis_osm_traffic_free_1.prj gis_osm_waterways_free_1.dbf
gis_osm_natural_a_free_1.dbf gis_osm_pofw_a_free_1.cpg gis_osm_pois_free_1.shx gis_osm_traffic_free_1.shp gis_osm_waterways_free_1.prj
gis_osm_natural_a_free_1.prj gis_osm_pofw_a_free_1.dbf gis_osm_railways_free_1.cpg gis_osm_traffic_free_1.shx gis_osm_waterways_free_1.shp
gis_osm_natural_a_free_1.shp gis_osm_pofw_a_free_1.prj gis_osm_railways_free_1.dbf gis_osm_transport_a_free_1.cpg gis_osm_waterways_free_1.shx
gis_osm_natural_a_free_1.shx gis_osm_pofw_a_free_1.shp gis_osm_railways_free_1.prj gis_osm_transport_a_free_1.dbf
gis_osm_natural_free_1.cpg gis_osm_pofw_a_free_1.shx gis_osm_railways_free_1.shp gis_osm_transport_a_free_1.prj
gis_osm_natural_free_1.dbf gis_osm_pofw_free_1.cpg gis_osm_railways_free_1.shx gis_osm_transport_a_free_1.shp
gis_osm_natural_free_1.prj gis_osm_pofw_free_1.dbf gis_osm_roads_free_1.cpg gis_osm_transport_a_free_1.shx我在这里做错了什么?我如何正确地生成GeoJSON文件?
发布于 2021-09-06 07:44:37
首先,没有turkmenistan-latest-free.shp形状文件,所以您不能将其转换为GeoJSON。
您可以转换目录中的任一shapefile:
gis_osm_buildings_a_free_1.shp
gis_osm_landuse_a_free_1.shp
gis_osm_natural_a_free_1.shp
gis_osm_natural_free_1.shp
gis_osm_places_a_free_1.shp
gis_osm_places_free_1.shp
gis_osm_pofw_a_free_1.shp
gis_osm_pofw_free_1.shp
gis_osm_pois_a_free_1.shp
gis_osm_pois_free_1.shp
gis_osm_railways_free_1.shp
gis_osm_roads_free_1.shp
gis_osm_traffic_a_free_1.shp
gis_osm_traffic_free_1.shp
gis_osm_transport_a_free_1.shp
gis_osm_transport_free_1.shp
gis_osm_water_a_free_1.shp
gis_osm_waterways_free_1.shp只需运行
ogr2ogr output.json input.shp
例如:
ogr2ogr gis_osm_buildings_a_free_1.json gis_osm_buildings_a_free_1.shp
您可以使用ogrinfo检查文件(输入或输出)是否有效
ogrinfo gis_osm_buildings_a_free_1.json
# INFO: Open of `gis_osm_buildings_a_free_1.json'
# using driver `GeoJSON' successful.
# 1: gis_osm_buildings_a_free_1https://stackoverflow.com/questions/69053309
复制相似问题