Maps

GeoJSON Viewer & Converter — KML, GPX, WKT and CSV on a Map

View and validate GeoJSON, KML, GPX, WKT or CSV on a map, fix common mistakes, and convert between the formats.

Runs entirely in your browser — nothing you paste is uploaded or stored.

Map100%

Load the example, paste geo data, or drop a .geojson, .kml, .gpx, .wkt or .csv file to see it on the map.

What is geojson viewer, validator & converter?

GeoJSON is the JSON format for geographic data, defined by RFC 7946: points, lines and polygons given as longitude/latitude coordinates, each wrapped in a Feature with its own properties. It is what web maps, spatial databases and most mapping APIs exchange, and it is easy to get subtly wrong. Coordinates written in latitude, longitude order put Sydney in the middle of nowhere, an unclosed polygon ring is rejected by PostGIS, a clockwise outer ring breaks some renderers, and coordinates copied from a projected system are millions of "degrees" off the globe. This tool draws your data on a map and checks it at the same time. It reads GeoJSON (including a bare geometry, a lone Feature and newline-delimited GeoJSON), KML from Google Earth, GPX from GPS devices and fitness apps, WKT and PostGIS EWKT, CSV files with latitude/longitude or WKT columns, and Google encoded polylines. Every finding names where in the file it is and what to do about it, the common mistakes have one-click fixes, and the result can be converted to GeoJSON, KML, GPX, WKT, CSV or an encoded polyline, with a plain note whenever the target format cannot hold part of the data. The map is drawn locally over a coarse world outline instead of map tiles, because fetching tiles would tell a tile server exactly which part of the world your data covers.

When to use it

  • Checking an API response or a database export before handing it to Leaflet, Mapbox, OpenLayers or PostGIS, so a bad ring or swapped axes is found now and not in production.
  • Opening a KML from Google Earth or a GPX track from a watch or cycling app to see what is in it, then converting it to GeoJSON for a web map — or GeoJSON to KML to open in Google Earth.
  • Working out why a point shows up in the ocean or Antarctica, which is almost always latitude and longitude written the wrong way round.
  • Pasting WKT from a SQL query (for example the output of ST_AsText or ST_AsEWKT) to see the geometry it describes on a map.
  • Plotting a spreadsheet of locations exported as CSV with lat and lon columns, without importing it into a GIS.
  • Decoding an encoded polyline from the Google Directions API, OSRM or Valhalla to see the route it describes.

How to use this tool

  1. Pick an example from the list (there is one in each format — GeoJSON, KML, CSV, WKT, GPX and an encoded polyline — plus some deliberately broken data), paste your own data into the left pane, or drop a .geojson, .json, .kml, .gpx, .wkt or .csv file onto it.
  2. The format is detected automatically and shown above the input; choose one from the Format list if detection guesses wrong.
  3. The map frames the data as it loads. Scroll or double-click to zoom, drag to pan, and click any feature to see its properties; with the keyboard, focus the map and use the arrow keys, plus, minus and 0.
  4. Read the Validation list further down. Each finding says where it is (for example features[3].geometry) and what is wrong.
  5. Use the Fixes to swap longitude and latitude, repair open rings and winding order, or round coordinates to fewer decimals; the map and output update immediately.
  6. Under "Convert to another format", just below the map, pick GeoJSON, KML, GPX, WKT, CSV or Encoded polyline, then copy or download the result. Download the map itself as SVG or PNG, or copy a share link with the data, fixes and chosen format.

Example

A great-circle flight from London Heathrow to New York JFK, plus the Bermuda Triangle — the built-in example.

Input

{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "properties": { "name": "London Heathrow (LHR)" },
      "geometry": { "type": "Point", "coordinates": [-0.4543, 51.47] }
    },
    {
      "type": "Feature",
      "properties": { "name": "New York JFK" },
      "geometry": { "type": "Point", "coordinates": [-73.7781, 40.6413] }
    },
    {
      "type": "Feature",
      "properties": { "name": "LHR to JFK, great circle" },
      "geometry": {
        "type": "LineString",
        "coordinates": [
          [-0.4543, 51.47], [-6.9618, 52.5725], [-13.7464, 53.302], [-20.7015, 53.6355],
          [-27.6996, 53.5619], [-34.6072, 53.0838], [-41.3027, 52.2167], [-47.69, 50.9871],
          [-53.7056, 49.4286], [-59.3177, 47.5785], [-64.5219, 45.4741], [-69.3329, 43.1509],
          [-73.7781, 40.6413]
        ]
      }
    },
    {
      "type": "Feature",
      "properties": { "name": "Bermuda Triangle" },
      "geometry": {
        "type": "Polygon",
        "coordinates": [[[-80.1918, 25.7617], [-66.1057, 18.4655], [-64.7814, 32.2949], [-80.1918, 25.7617]]]
      }
    }
  ]
}

Output

Valid GeoJSON with no RFC 7946 problems. 4 features (2 Point, 1 LineString, 1 Polygon) and 19 positions; the flight path is 5,540 km long, the triangle covers about 1,140,730 km², and the bounding box is [-80.1918, 18.4655, -0.4543, 53.6355]. On the map the shortest route bows far to the north — a straight line on Mercator is not the shortest path on the globe.

The example list also has a polygon with a hole (the Pentagon), the New 7 Wonders as KML, world capitals as CSV, Colorado and Wyoming as WKT, a GPX run, Google's sample polyline, and deliberately broken data with swapped coordinates and an open ring to try the fixes on.

What the validator checks

Structure, for GeoJSON input: every object has a known type (case matters, so "point" is an error), coordinates are nested the way their geometry type requires and contain only numbers, every Feature has a geometry and a properties member, ids are strings or numbers, and a declared bbox really contains the geometry. The removed crs member and nested GeometryCollections are flagged as warnings.

Geometry, for every format: longitude within −180…180 and latitude within −90…90, lines with at least two positions, polygon rings that are closed and have at least four positions, the right-hand winding rule, positions with more than three values, and segments that jump across the antimeridian. When the out-of-range values have an obvious explanation, such as swapped axes or metres instead of degrees, that diagnosis is listed first. A file with thousands of bad points produces a few grouped findings, not thousands of lines.

Why the map has no street tiles

A normal web map downloads image tiles for whatever area is on screen, so the tile server learns where your data is. Here the map is an SVG drawn in the page: your features, a latitude/longitude grid, and the public-domain Natural Earth 1:110m coastline for orientation. It uses the Web Mercator projection, like most web maps. The downloaded SVG and PNG are made the same way, from exactly what you see.

Frequently asked questions

Why does my point show up in the wrong place, often in the ocean or Antarctica?

Almost always because the coordinates are in latitude, longitude order. GeoJSON is longitude first, [x, y], which is the opposite of how people usually say coordinates aloud and of what Google Maps shows. When a swapped value falls outside the valid range (a latitude above 90), this tool says so and suggests the fix. Data from Europe or Africa can be swapped yet still in range, so if everything lands on the wrong continent, try the Swap lon/lat fix and see whether it moves where you expect.

What is the right-hand rule and does winding order matter?

RFC 7946 says a polygon's outer ring should run counter-clockwise and its holes clockwise. Many libraries ignore the direction, but some renderers and spatial databases depend on it, and a reversed ring can fill the whole world instead of the shape. The validator flags rings wound the wrong way, and the Repair geometry fix reverses them, closes rings whose last position does not repeat the first, and removes repeated consecutive points.

My coordinates are numbers like 4,500,000. What went wrong?

Those are projected coordinates, usually metres in Web Mercator (EPSG:3857) or a UTM zone, not degrees. GeoJSON only allows WGS 84 longitude and latitude, and the old "crs" member that once said otherwise was removed in RFC 7946. The data has to be reprojected, for example with ogr2ogr -t_srs EPSG:4326 or ST_Transform in PostGIS. No browser tool can guess which projection it came from.

Is my data uploaded anywhere?

No. Parsing, validation, measuring and drawing all happen in your browser, and the tool makes no network requests with your data. That is also why the map has no street tiles. Loading tiles would tell a tile server which area you are looking at, so the background is a coarse world coastline that ships with the page. It is hidden when you zoom in past about one degree, where it would be too rough to trust.

Which parts of KML and GPX are read?

From KML, every Placemark's Point, LineString, Polygon with holes, MultiGeometry and gx:Track, plus its name, description and ExtendedData as properties. Styles, ground overlays and network links are ignored. KMZ files are zipped KML, so unzip one and open the doc.kml inside. From GPX, waypoints, routes and tracks (including multi-segment tracks), with elevation kept as altitude and the name, description and time as properties.

What is lost when converting between formats?

GeoJSON and KML can hold everything here, including properties (KML stores them as ExtendedData). GPX has no polygons, and keeps only a name and description per feature. WKT is geometry only. CSV keeps every property, with longitude and latitude columns when all features are points and a WKT column otherwise. An encoded polyline is coordinates only, at about one-metre precision. Whenever a conversion leaves something out, a note above the output says exactly what, so nothing disappears silently.

How are length and area calculated?

On a spherical Earth with a mean radius of 6,371 km: great-circle length for lines, and spherical polygon area with holes subtracted. That is within about half a percent of the ellipsoidal result, which is plenty for checking data. Use a GIS or PostGIS geography type for survey-grade measurements.

Find these tools useful? A coffee helps keep them free and ad-light.

Buy me a coffee