Shapefile viewer: open a .shp map layer without GIS software
Open the map data a council, a national mapping agency or an open-data portal hands out as a shapefile, without installing QGIS or ArcGIS. Choose the .shp together with its .dbf, .shx, .prj and .cpg, or the ZIP they came in: the shapes are drawn, the attribute table is shown and searchable, and tapping a shape finds its row.
The files are read on your device. Nothing is uploaded, and no map tiles are fetched: the shapes are drawn from their own coordinates.
What it shows
- The shapes. Points, multipoints, lines and polygons, fit to the screen. Drag to move, pinch or scroll to zoom, double-click (or Fit) to see everything again. Polygon holes stay empty: a lake inside a park, or Lesotho inside South Africa, is not painted over. PointZ, PolyLineZ, PolygonZ and the M (measure) types are read in full and drawn flat, seen from above.
- The attribute table. Every field of the .dbf with its name and dBASE type (text, number with its decimals, date, yes/no, and the Visual FoxPro integer, double, currency and date-time types), and every row, searchable across all values. Records marked deleted in the .dbf are shown struck through, because GIS programs hide them.
- Shape to row, row to shape. Tap a shape and its row is highlighted and its values listed under the map; tap a row and its shape is highlighted in yellow and brought into view.
- Feature count, shape type and extent. The number of records, the shape type from the header, how many rings and holes the polygons have, and the bounding box.
- The coordinate system. The .prj text as it is, and a plain answer to the question most people have: is this WGS 84 longitude and latitude (what GPS, GeoJSON and web maps use), another datum, or projected metres or feet?
- Saves. The layer as GeoJSON with every attribute, and the table (or just the rows your search found) as CSV that Excel opens with accents intact. Both are made in the page and downloaded straight from it.
A shapefile is several files, and which ones matter
The name is singular, but a shapefile is a set of files with one base name. roads.shp holds the geometry, roads.dbf the attribute table (one row per shape, matched only by position: the 12th shape is the 12th row), roads.shx an index of where each shape starts, roads.prj the coordinate system as text, and roads.cpg the code page of the table's text. Sent on its own, a .shp shows shapes with no names; this page draws it anyway and says that the .dbf is missing. Without the .shx it reads the records in order, which works for a normally written file, but QGIS and ArcGIS refuse to open it by default, so keep the .shx with it. Other files beside them (.sbn, .sbx, .qix spatial indexes, .shp.xml metadata) are not needed to see the data and are ignored.
Why place names come out garbled, and how this page avoids it
A .dbf stores text as bytes in a code page, and the shapefile format does not say which one by itself. Read with the wrong one, “Zürich” stored in Windows-1252 (the ü is the single byte FC) becomes “Z�rich” in a UTF-8 reader, and “Zürich” stored as UTF-8 (C3 BC) becomes “Zürich” in a Windows-1252 reader. This page decodes in this order: the code page named in the .cpg file (“UTF-8”, “1252”, “ANSI 1251”, “CP1250”, “88591”, “SJIS” and similar); otherwise the language driver byte at offset 29 of the .dbf header (for example 0x57 for ANSI Windows-1252, 0xC9 for Cyrillic 1251, 0x26 for DOS 866); otherwise UTF-8 if every text value is valid UTF-8; otherwise Windows-1252, with a note saying it guessed. The code page used, and where it came from, is shown above the table.
Polygons with holes: a worked example
A shapefile polygon is a list of rings, and the direction each ring runs is what makes it an outline or a hole: the ESRI specification has outer rings run clockwise and holes counter-clockwise. Take a 10 × 10 square parcel with a 4 × 4 courtyard cut out of its middle. The outer ring (0,0) → (0,10) → (10,10) → (10,0) is clockwise; the shoelace formula gives it a signed area of −100. The courtyard ring (3,3) → (7,3) → (7,7) → (3,7) is counter-clockwise, signed area +16. So the parcel's area is 100 − 16 = 84, and a tap at (5, 5), in the courtyard, does not select it. A reader that treats every ring as an outline counts 100 + 16 = 116 and turns the courtyard into a second parcel. When this page saves GeoJSON it writes the rings the other way round, outer counter-clockwise and holes clockwise, as the GeoJSON standard (RFC 7946) asks, without changing any coordinate.
Files it opens
- .shp, .shx, .dbf, .prj, .cpg
- Read with a reader written for this page from the ESRI Shapefile Technical Description (1998) and the dBASE file layout, with no GIS library. All 14 shape types: Null, Point, MultiPoint, PolyLine, Polygon, their Z and M variants, and MultiPatch (drawn as the outlines of its parts).
- A ZIP from a download portal
- Unpacked in the page. When it holds several shapefiles (a whole dataset, or one per region), they are listed and the first is opened; tap another to switch.
- A .dbf on its own
- Any dBASE III, dBASE IV or Visual FoxPro table opens as a searchable table that saves as CSV, map or not.
What this cannot do
- Reproject. Coordinates are drawn and saved exactly as stored. A layer in a national grid (British National Grid, UTM, a US State Plane) stays in metres or feet, and its GeoJSON will land in the wrong place on a web map until it is reprojected to WGS 84 in QGIS or with
ogr2ogr -t_srs EPSG:4326. The page says so when the .prj is not WGS 84. Lon/lat data is drawn as a plain grid of degrees, so areas near the poles look stretched. - Show a basemap. There are no streets or satellite pictures underneath: fetching map tiles would tell a tile server where you are looking, and viewhack loads nothing from other hosts.
- Edit. It only reads; nothing is written back to the shapefile.
- Read file geodatabases. An Esri file geodatabase (a .gdb folder) is a different, more complex format, and is named but not read. A GeoPackage (.gpkg) is a SQLite database: its tables open in the SQLite viewer, without the map.
- Read memo fields. Long text kept in a .dbt or .fpt memo file is shown as a reference to its block, not the text.
- Style or label. Every shape is drawn in one colour, without labels or the styling a .qml, .lyr or .sld file may carry.