Overview
Introduction
Sometimes you don't want to convert a shapefile to GeoJSON text, you just want to see what shape it actually contains, without opening a full desktop GIS application.
Shapefile Viewer uploads a zipped shapefile and draws its geometry directly, points, lines, and polygons rendered as plain SVG shapes fit to their own bounding box.
What Is Shapefile Viewer?
A client-side shapefile previewer: shpjs parses the uploaded zip into GeoJSON internally, and a shared SVG-rendering helper projects every coordinate to fit a fixed viewBox, drawing lines/polygons as SVG paths and points as small circles.
It's intentionally not a full interactive map, there's no panning, zooming, or basemap imagery, just a straightforward visual check of the shapes a shapefile contains.
How Shapefile Viewer Works
The uploaded zip is read as raw bytes and handed to shpjs, which unzips it, parses .shp geometry and .dbf attributes, and returns GeoJSON (merging every layer if the zip bundles more than one).
The resulting FeatureCollection is passed through this category's shared geoJsonToSvgPaths helper, which computes the overall longitude/latitude bounding box, linearly maps it to the SVG viewBox, and returns ready-to-render path and point coordinates.
When To Use Shapefile Viewer
Use this whenever you want a quick visual check of a shapefile's geometry, its rough shape, extent, and feature count, without exporting anything or opening desktop GIS software.
It's especially handy for a first look at a shapefile you didn't create yourself, to confirm it contains what you expect before converting or processing it further.
Often used alongside Shapefile to GeoJSON Converter and GeoJSON Viewer.
Features
Advantages
- Runs entirely client-side, your shapefile data never leaves your browser and no map tiles are fetched.
- Instant visual feedback on a shapefile's geometry without needing GIS desktop software.
- Handles multi-layer zips by drawing every layer's merged geometry together.
Limitations
- No panning, zooming, or interactivity, it's a static preview fit to the data's bounding box.
- No basemap imagery (roads, place names, terrain), by deliberate design, see the FAQ above.
- Only accepts a zipped bundle, a bare .shp file alone isn't supported.
Examples
Best Practices & Notes
Best Practices
- Use this before Shapefile to GeoJSON Converter as a quick sanity check that the zip actually contains what you expect.
- Check the legend's geometry type list if a preview looks empty, an unsupported or unexpected geometry type may be present.
- Include a .prj file in your zip for shapefiles in a non-standard projection, for correctly shaped (if not basemap-aligned) output.
Developer Notes
`readShapefileForViewer` in `shapefile-viewer.ts` shares its parsing logic (normalize shpjs's single-or-array result, flatMap into one FeatureCollection) with `shapefile-to-geojson-converter.ts`, but returns the parsed `FeatureCollection` object directly rather than a JSON string, since the component feeds it straight into the shared `geoJsonToSvgPaths(featureCollection, {width, height, padding})` helper from `geo-svg-render.ts` rather than exporting text.
Shapefile Viewer Use Cases
- Quickly checking what a shapefile zip actually contains before converting or processing it further
- Visually confirming a multi-layer shapefile zip's combined extent and feature count
- Sanity-checking shapefile geometry without installing desktop GIS software
Common Mistakes
- Expecting to see roads, place names, or satellite imagery behind the shapes, this viewer deliberately draws only the shapefile's own geometry, never fetched basemap tiles.
- Uploading a bare .shp file without its accompanying .dbf zipped alongside it, the zip needs at least both to be read correctly.
Tips
- If the preview looks unexpectedly tiny or off in one dimension, check whether your data spans a very different range in longitude versus latitude, the bounding-box fit stretches to the viewBox regardless of aspect ratio.
- Use Shapefile to GeoJSON Converter afterward once you've confirmed the shape looks right, to get the actual GeoJSON text out.