Closed iferencik closed 2 years ago
Please attach or point to a dataset (or a minimum extract that can be used to reproduce the issue, likely one of those islands) that can be used to reproduce the issue
I added the whole shapefiles as they are not very large
admin0-sids-4326.zip admin0-3857.zip
thank you
Hello
I am having issues with converting vector data in shapefile format to MVT (.pbf and mbtiles). I have a rather peculiar dataset, admin0 level of small island countries. I tried to convert this dataset to MVT DIRECTORY format but encountered following:
ogr2ogr -f MVT -s_srs EPSG:4326 -t_srs EPSG:3857 -dsco FORMAT=DIRECTORY -dsco COMPRESS=NO -dsco MAX_SIZE=1500000 -dsco NAME=admin0 -lco NAME=admin0 -lco MAXZOOM=5 -lco MINZOOM=0 mvt admin0-sis-4326.shp
basically ogr2ogr used all my RAM and my system becomes unresponsive.
here is the ogrinfo on the input shapefile
ogrinfo -so -al admin0-sids-4326.shp INFO: Open of
admin0-sids-4326.shp' using driver
ESRI Shapefile' successful.Layer name: admin0-sids-4326 Metadata: DBF_DATE_LAST_UPDATE=2022-01-13 Geometry: Polygon Feature Count: 57 Extent: (-180.000000, -22.349724) - (180.000000, 32.477226) Layer SRS WKT: GEOGCRS["WGS 84", DATUM["World Geodetic System 1984", ELLIPSOID["WGS 84",6378137,298.257223563, LENGTHUNIT["metre",1]]], PRIMEM["Greenwich",0, ANGLEUNIT["degree",0.0174532925199433]], CS[ellipsoidal,2], AXIS["latitude",north, ORDER[1], ANGLEUNIT["degree",0.0174532925199433]], AXIS["longitude",east, ORDER[2], ANGLEUNIT["degree",0.0174532925199433]], ID["EPSG",4326]] Data axis to CRS axis mapping: 2,1 GID_0: String (80.0) NAME_0: String (80.0)
I looked into the geometries and discovered that 2 countries (Fiji and Kiribati ) are crossing the 180 antimeridian.
After exploding these geemetries I reprojected the shapefile to EPSG:3857 and then tried again.
ogr2ogr -f MVT -s_srs EPSG:3857 -t_srs EPSG:3857 -dsco FORMAT=DIRECTORY -dsco COMPRESS=NO -dsco MAX_SIZE=1500000 -dsco NAME=admin0 -lco NAME=admin0 -lco MAXZOOM=5 -lco MINZOOM=0 mvt admin0-3857.shp --debug on Shape: DBF Codepage = LDID/87 for admin0-3857.shp Shape: Treating as encoding 'ISO-8859-1'. GDAL: GDALOpen(admin0-3857.shp, this=0x55e037572c30) succeeds as ESRI Shapefile. GDAL: GDALDriver::Create(MVT,mvt,0,0,0,Unknown,0x55e0375773a0) MVT: Creating temporary database... GDALVectorTranslate: 59 features written in layer 'admin0-3857' Shape: 59 features read on layer 'admin0-3857'. GDAL: GDALClose(admin0-3857.shp, this=0x55e037572c30) MVT: Building output file from temporary database... GDAL: GDALClose(mvt, this=0x55e037536c00)
This time everything looked OK but the mvt folder is empty except metadata.json file
{ "name":"admin0", "description":"", "version":2, "minzoom":0, "maxzoom":5, "center":"0.0000000,0.0000455,0", "bounds":"-0.0016170,-0.0002008,0.0016170,0.0002917", "type":"overlay", "format":"pbf", "json":"{\n \"vector_layers\":[\n ],\n \"tilestats\":{\n \"layerCount\":0,\n \"layers\":[\n ]\n }\n}"
Expected behavior and actual behavior.
a folder with .pbf files should be created for each zoom level
Steps to reproduce the problem.
Operating system
Ubuntu 20.04 64 bit
GDAL version and provenance
GDAL 3.0.4, released 2020/01/28