Geodata Converter (KML, GPX, Shapefile, WKT) API

Convert KML, KMZ, GPX, zipped Shapefiles, WKT / WKB and CSV to GeoJSON and back, with simplification and reprojection (UTM, Web Mercator, VN-2000).

POSThttps://apibox.io.vn/v1/geo-convert

Send the data as a file (KML, KMZ, GPX, Shapefile .zip with .shp / .dbf / .prj / .cpg, CSV, WKT, WKB, GeoJSON) or as data text; the format is detected or set with from. KML / KMZ placemarks keep their name, description and ExtendedData; GPX waypoints, routes and tracks (elevation and times) are read; Shapefiles are reprojected from their .prj to WGS84 and decoded with the .cpg code page; CSV needs lat / lon columns (also “vĩ độ” / “kinh độ”, or set lat_column / lon_column) or a WKT column; WKT and hex / base64 WKB (EWKB with SRID, Z) are one geometry per line.

to chooses the output: geojson (default, as an object), kml, gpx (polygons become tracks of their outer ring), csv (lat / lon for points, otherwise a WKT column), wkt or wkb (hex). simplify applies Douglas–Peucker with a tolerance in metres, precision rounds coordinates. Reproject with from_crs / to_crs: EPSG:4326, EPSG:3857, UTM (EPSG:326xx / 327xx), VN-2000 UTM (EPSG:3405 / 3406) and VN-2000 TM-3 as vn2000:<central meridian> (e.g. vn2000:105.5 for Hà Nội) with the national 7-parameter transformation (same as /v1/vn-vn2000), or any proj4 string / WKT.

The response gives the feature count, geometry types, coordinate count before / after simplification and the bbox; download=true returns the file itself.

Markdown · OpenAPI · Postman · llms.txt

Parameters

NameInTypeRequiredDefault
filebodyfilenoInput file (KML, KMZ, GPX, Shapefile .zip, CSV, WKT, WKB, GeoJSON).
databodystringnoInput as text (KML, GPX, GeoJSON, WKT, hex WKB, CSV).
frombody|querystringnoInput format: geojson, kml, kmz, gpx, shp, wkt, wkb, csv (auto-detected).
tobody|querystringnogeojsonOutput: geojson, kml, gpx, csv, wkt, wkb.
from_crsbody|querystringnoSource CRS when the data is not WGS84 lon/lat (EPSG code, vn2000:105.5, proj4 or WKT).
to_crsbody|querystringnoTarget CRS (default EPSG:4326).
simplifybody|querynumbernoDouglas–Peucker tolerance in metres (lon/lat output).
precisionbody|querynumbernoDecimals kept (default 7 for degrees, 3 for metres).
downloadbody|querybooleannofalseReturn the converted file instead of JSON.

Example

curl -X POST "https://apibox.io.vn/v1/geo-convert" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data":"<kml xmlns=\"http://www.opengis.net/kml/2.2\"><Document><Placemark><name>Hồ Gươm</name><Point><coordinates>105.8523,21.0288</coordinates></Point></Placemark></Document></kml>","to_crs":"vn2000:105.5"}'

Response

{
  "from": "kml",
  "to": "geojson",
  "crs": "vn2000:105.5",
  "features": 1,
  "geometry_types": {
    "Point": 1
  },
  "coordinates": {
    "before": 1,
    "after": 1
  },
  "bbox": [
    536422.326,
    2326182.02,
    536422.326,
    2326182.02
  ],
  "warnings": [],
  "geojson": {
    "type": "FeatureCollection",
    "features": [
      {
        "type": "Feature",
        "geometry": {
          "type": "Point",
          "coordinates": [
            536422.326,
            2326182.02
          ]
        },
        "properties": {
          "name": "Hồ Gươm"
        }
      }
    ]
  }
}

Use cases

  • Load Google My Maps / Google Earth KML or KMZ into a web map as GeoJSON
  • Convert cadastral or planning Shapefiles (VN-2000) to WGS84 for web apps
  • Turn a Strava / GPS track (GPX) into GeoJSON or KML
  • Import spreadsheet points (lat / lon columns) into a GIS or map

FAQ

Which coordinate system is the output?

WGS84 longitude / latitude by default. Set to_crs (for example EPSG:3857 or vn2000:105.5) for projected output.

My Shapefile has no .prj, what now?

Coordinates are returned as stored; set from_crs (for example vn2000:105.5 or EPSG:32648) to reproject them.

Are TCVN3 (ABC) encoded attributes supported?

Code pages declared in the .cpg (UTF-8, Windows-1258, …) are decoded; legacy TCVN3 font encodings are not converted.

Related APIs

Start with 1,000 free requests every month. Get free API key →