Overview
Introduction
Sometimes you just want to see what a piece of GeoJSON looks like, without converting it, validating it, or pasting it into a full mapping application.
GeoJSON Viewer renders pasted GeoJSON as an SVG preview of its points, lines, and polygons, along with a legend summarizing feature count and geometry types.
What Is GeoJSON Viewer?
A read-only GeoJSON geometry previewer built on this category's shared SVG-rendering helper. It fits the data's longitude/latitude bounding box to a fixed viewBox and draws lines and polygons as SVG paths, points as small circles.
Every geo tool in this category that converts to or from GeoJSON links back to this viewer as the standard way to inspect the result.
How GeoJSON Viewer Works
The pasted text is JSON.parse'd and normalized to a FeatureCollection: a FeatureCollection passes through as-is, a bare Feature or raw geometry object gets wrapped in one automatically.
That FeatureCollection is handed to the shared geoJsonToSvgPaths helper, which walks every coordinate to find the overall bounding box, then linearly projects each geometry into SVG path/point coordinates ready to render directly.
When To Use GeoJSON Viewer
Use this whenever you have GeoJSON, from an API response, a converted KML/GPX/shapefile, or hand-written test data, and want to quickly confirm it looks like what you expect.
It's especially useful right after using any of this category's converters, as the last sanity check before trusting the converted output.
Often used alongside KML to GeoJSON Converter, GPX to GeoJSON Converter and Shapefile Viewer.
Features
Advantages
- Runs entirely client-side. Your GeoJSON never leaves your browser, and no map tiles are fetched.
- Accepts FeatureCollections, bare Features, and raw geometry objects without requiring manual wrapping.
- A feature-count and geometry-type legend gives a summary alongside the visual preview.
Limitations
- No panning, zooming, or interactivity. It's a static preview fit to the data's bounding box.
- No basemap imagery: no roads, place names, or terrain are drawn.
- GeometryCollection members and any unrecognized geometry types are skipped rather than rendered.
Examples
Best Practices & Notes
Best Practices
- Use this right after any conversion (KML, GPX, or shapefile to GeoJSON) as a quick visual sanity check before trusting the output.
- Check the legend's geometry-type list if the preview looks emptier than expected. An unsupported geometry type may be present in your data.
- Paste a bare geometry object directly when you just want to check one shape, no need to wrap it in a Feature or FeatureCollection yourself.
Developer Notes
`parseGeoJsonForViewer` in `geojson-viewer.ts` normalizes three possible top-level GeoJSON shapes (FeatureCollection, Feature, or a raw Geometry) into a single FeatureCollection. The component then calls the shared `geoJsonToSvgPaths` from `geo-svg-render.ts`, which keeps the projection math shape-agnostic and reusable by `shapefile-viewer.ts`.
GeoJSON Viewer Use Cases
- Sanity-checking GeoJSON right after converting it from KML, GPX, or a shapefile
- Quickly previewing an API response's geometry without pasting it into a full mapping application
- Visually inspecting hand-written or generated GeoJSON test data before using it elsewhere
Common Mistakes
- Expecting to see roads, place names, or imagery behind the shapes. This viewer draws only the GeoJSON's own geometry; no basemap tiles are fetched.
- Pasting invalid JSON, such as a trailing comma or unquoted keys, and expecting the geometry to render anyway. Valid JSON is required before parsing starts.
Tips
- If the preview looks stretched, that's the bounding-box fit mapping the data's actual lon/lat extent to the viewBox regardless of aspect ratio.
- Pair with Lat/Lng Point Finder if you need to manually add a reference coordinate alongside geometry you're previewing here.