Convert a shapefile to GeoPackage or GeoJSON with ogr2ogr while avoiding character-encoding corruption

domain: gdal.org · 4 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

Steps

  1. Run ogr2ogr -f GPKG output.gpkg input.shp (or -f GeoJSON output.geojson input.shp) for the target format
  2. If the shapefile has no .cpg file, set the SHAPE_ENCODING config option to the true source encoding before conversion
  3. Know that without a .cpg file or explicit encoding override, GDAL defaults to reading DBF strings as ISO-8859-1
  4. For zipped shapefiles or file geodatabases, reference them through the /vsizip/ virtual filesystem path rather than extracting manually

Known gotchas

Give your agent this knowledge — and 15,500+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans