0

I'm trying to generate MBTiles file using tippecanoe and to do that first I am converting a shape file downloaded from Geofabric downloads to a GeoJSON file using ogr2ogr and then using that GeoJSON file to MBTiles file using tippecanoe.

The step I'm stuck on is this

ogr2ogr -f GeoJSON turk.geojson turkmenistan-latest-free.shp

The file which I downloaded from Geofabric is a .shp.zip file - https://download.geofabrik.de/asia/turkmenistan-latest-free.shp.zip. On extracting this zip file I get a folder which contains various files like gis_osm_buildings_a_free_1.cpg etc. However, there was no turkmenistan-latest-free.shp file - or one .shp file which contained all of Turkmenistan.

When I run ogr2ogr command directly on the folder which was extracted out of the .zip file, I get this error

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)

If I run the same command with -skipfailures, I get more errors

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.

However, on inspecting the folder all these files already exist in it, but ogr2ogr is somehow unable to find it. These are the files in the folder

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

What am I doing incorrectly here and how can I properly generate the GeoJSON file?

vepzfe
  • 4,217
  • 5
  • 26
  • 46

1 Answers1

0

First, there is no turkmenistan-latest-free.shp shape file, so you can't convert it to GeoJSON.

You can convert either of the shapefiles in your directory:

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

by just running

ogr2ogr output.json input.shp

like for example:

ogr2ogr gis_osm_buildings_a_free_1.json gis_osm_buildings_a_free_1.shp

You can check if the files (input or output) are valid with 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_1
Val
  • 6,585
  • 5
  • 22
  • 52