GEOO.APPGEOO.APP
Back to all posts
2026-11-0529 min readGeoJSONBenchmarkWebAssemblyCSVPerformance

How Big Is 199,031 Points? Measuring Eight GIS Output Formats

A reproducible benchmark on 199,031 real village-name coordinates: raw bytes, gzip size, serialization time, parse time and coordinate-rounding error for CSV, GeoJSON, GeoJSONSeq, KML, GPX, WKT and TopoJSON-style arcs. Includes runnable Python and TypeScript.

"GeoJSON is verbose" is one of those statements everybody repeats and almost nobody measures. It is true, but the useful question is not whether it is true. The useful question is: how verbose, compared with what, and does the difference survive gzip? And if the conversion happens entirely inside a browser tab, what does that difference cost in memory and main-thread time?

I build geoo.app, a set of GIS converters that run client-side. When a user drops a CSV of coordinates onto the page, the file is read into an ArrayBuffer, parsed, serialized into the target format, wrapped in a Blob, and handed to the browser as a download. Nothing is uploaded. That design has a pleasant privacy property and an unpleasant performance property: every byte of the output is materialised in the tab's memory, and unless the work is moved to a Worker, every millisecond of serialization is a millisecond the UI cannot respond.

So I ran the numbers. This article reports a benchmark over 199,031 real named places, eight output representations, four dataset sizes, raw and compressed bytes, serialization and parse timings, and a coordinate-rounding experiment. All values below were produced by the scripts in this article. No number is estimated, and no coordinate is synthetic.

One dataset written eight different ways, with the measured size spread

Figure 1. The same 199,031 point features written in eight representations. The uncompressed sizes span a factor of 7.1; after gzip -6 the spread shrinks to about 1.3.

1. The dataset

The primary input is a plain CSV shipped with the project's test fixtures: testdata/csv/村名.csv. It contains 199,031 rows of village names with WGS84 longitudes and latitudes, encoded in GBK. The file is 5.7 MiB on disk. The header is name,lon,lat, and the first three data rows are:

吴太保村,114.661328,36.05983628
东吕村,114.62129,36.07279938
张河干村,114.675839,36.12904277

The coordinates span 110.362054–116.638137 E and 31.39054128–36.35769938 N, centred near 113.5001 E, 33.8741 N. That is a real, irregularly distributed cluster of settlements rather than a uniform random scatter. There is also a second, smaller fixture — 17,289 named residential compounds (居民小区点.csv), UTF-8 encoded — which is used below for the map figure and as a cross-check.

Why insist on real data? Because compression results on synthetic coordinates are misleading. Random floats have almost no repeated digit prefixes, and random strings have no repeated vocabulary. Real place names repeat characters, share suffixes such as 村 and 镇, and cluster geographically, so adjacent rows share leading digits of longitude. A benchmark generated with random.uniform() would overstate compressed sizes for every text format and understate the benefit of gzip. The geographic clustering also makes the coordinate-rounding experiment meaningful, because the error is measured at real positions rather than at arbitrary points.

The village points plotted from their original coordinates

Figure 2. One in every 97 village points, plotted at its original coordinates, with the 17,289 compound points overlaid in orange. The dataset covers a contiguous region, not a random scatter.

I sampled four dataset sizes from this file: 1,000, 10,000, 50,000 and all 199,031 rows. Sampling the first N rows rather than a random subset keeps the experiment reproducible with a single head-style slice.

2. The eight representations

Each writer receives the same list of (name, lon, lat) tuples and emits exactly one point feature per row, with the name preserved as an attribute. The formats are:

#RepresentationNotes
1CSVname,lon,lat, UTF-8, one row per point — the input shape
2GeoJSON (compact)FeatureCollection, separators=(',', ':'), no ASCII escaping
3GeoJSON (pretty)same object, indent=2
4GeoJSONSeq (NDJSON)RFC 8142 text sequences: one Feature per line, RS (U+001E) prefix
5KML 2.2one <Placemark> with <Point><coordinates> per row
6GPX 1.1one <wpt lat lon> with <name> per row
7WKT + attributesSRID=4326;POINT (lon lat) plus a tab-separated name column
8TopoJSON-style arcsquantized, delta-encoded arcs with an objects collection

A deliberate scope note: these writers are small, format-correct serializers written in Python, not the output of GDAL's ogr2ogr. They exist to compare the cost of each representation, not to benchmark a particular conversion engine. A real GDAL export would add projection metadata, .prj/.dbf/.shx sidecars, field typing, and possibly geometry simplification — all of which change absolute byte counts. What stays valid across engines is the structural cost: repeated JSON keys, XML tag overhead, indentation, and the effect of compression on that repetition. I return to this limitation in section 10.

The core GeoJSON feature builder is small enough to show in full:

import json

def feature(name: str, lon: float, lat: float) -> dict:
    return {
        "type": "Feature",
        "properties": {"name": name},
        "geometry": {"type": "Point", "coordinates": [lon, lat]},
    }

def geojson_compact(rows) -> bytes:
    fc = {"type": "FeatureCollection",
          "features": [feature(*r) for r in rows]}
    return json.dumps(fc, ensure_ascii=False,
                      separators=(",", ":")).encode("utf-8")

ensure_ascii=False matters here. With the default True, every Chinese character becomes six ASCII bytes (\u5434), which would inflate the GeoJSON numbers by roughly 50% and make the comparison meaningless for a Chinese-language dataset. Any benchmark of GeoJSON with non-ASCII attributes must state this setting explicitly.

3. The measurement harness

The harness reads the GBK CSV, slices it, runs every writer, records the byte length, compresses with gzip at level 6 with a fixed mtime=0 (so the output is deterministic), and times serialization. Small sizes are repeated five times and the median is taken; the two largest sizes are run once because a single pass already takes hundreds of milliseconds.

import csv, gzip, io, statistics, time

RAW = open("testdata/csv/村名.csv", "rb").read().decode("gbk")
rows, bad = [], 0
for i, row in enumerate(csv.reader(io.StringIO(RAW))):
    if i == 0 or len(row) < 3:
        continue
    try:
        rows.append((row[0], float(row[1]), float(row[2])))
    except ValueError:
        bad += 1

print(len(rows), "points,", bad, "skipped")

def timed(fn, sample, repeats=5):
    durations, blob = [], b""
    for _ in range(repeats):
        t0 = time.perf_counter()
        blob = fn(sample)
        durations.append((time.perf_counter() - t0) * 1000)
    gz = gzip.compress(blob, compresslevel=6, mtime=0)
    return {"bytes": len(blob),
            "gzip": len(gz),
            "serialize_ms": round(statistics.median(durations), 2)}

for n in (1_000, 10_000, 50_000, len(rows)):
    sample = rows[:n]
    for label, writer in WRITERS.items():
        r = timed(writer, sample, 5 if n <= 10_000 else 1)
        print(f"{label:22s} {n:7d}  {r['bytes']:10d} B  "
              f"gz {r['gzip']:9d} B  {r['serialize_ms']:8.1f} ms")

Environment: CPython 3.13 on macOS, gzip from the standard library (deflate, level 6), and Node.js 22 for the JavaScript parse measurement. All files were produced in memory; no disk I/O is included in the serialization timings. Timings are single-machine observations, not statistically robust estimates — the byte counts are exact and reproducible, while the millisecond values should be read as orders of magnitude.

One small trap worth documenting: RFC 8142 GeoJSON text sequences use U+001E (RS) as a record separator, and Python's str.splitlines() treats U+001E as a line boundary. Splitting an NDJSON payload with splitlines() silently produces empty fragments and a JSONDecodeError. Split on \n explicitly.

4. Result one: raw byte counts

Here are the exact byte counts for all four dataset sizes. Values are bytes, not rounded megabytes.

Representation1,00010,00050,000199,031
CSV33,923326,7131,612,4886,383,827
GeoJSON (compact)120,9511,196,7415,962,51623,699,552
GeoJSON (pretty)229,9632,286,75311,412,52845,393,943
GeoJSONSeq (NDJSON)121,9101,206,7006,012,47523,898,542
KML113,0431,116,8335,562,60822,107,396
GPX70,043686,8333,412,60813,549,063
WKT + attributes51,924506,7142,512,4899,966,386
TopoJSON (arcs)108,1481,067,9085,311,24721,107,270

Bar chart of raw and gzip sizes for all eight formats

Figure 3. Raw bytes (coloured) and gzip -6 bytes (grey) for 199,031 points. The two bars share the same scale.

Four observations follow directly from the table.

Growth is almost perfectly linear. Doubling the row count doubles every format's size, because each representation is a per-feature record plus a constant header. At 199,031 rows the per-feature cost ranges from about 32 bytes for CSV to about 228 bytes for pretty-printed GeoJSON. There is no hidden super-linear term for point data, which is useful when estimating a large job from a small sample: measure 1,000 rows, multiply.

Indentation is expensive. Pretty GeoJSON is 45,393,943 bytes against 23,699,552 for compact — a factor of 1.92 — for exactly the same information. Humans rarely read a 199,031-feature file, so there is no reason to pretty-print a machine-to-machine export. If a readable preview is needed, format only the first few features in the UI.

GPX is 39% smaller than KML for identical content (13.55 MB vs 22.11 MB). The reason is purely lexical: <wpt lat="..." lon="..."><name>...</name></wpt> is shorter than <Placemark><name>...</name><Point><coordinates>lon,lat,0</coordinates></Point></Placemark>. GPX also loses the altitude component we were padding with a zero anyway. Neither format is "better"; they target different consumers, but the size difference is real and mostly tag overhead.

WKT plus a tab-separated attribute column is the leanest structured text at 9.97 MB, close to the CSV it came from. It is also the least self-describing: a consumer must be told the geometry column, the SRID convention, and the delimiter. That trade-off — bytes versus explicitness — is the whole story of the table.

5. Result two: compression erases the difference

Now the same files after gzip -6:

Representationgzip bytes @ 199,031ratio to smallest
CSV2,607,7841.00
WKT + attributes2,782,4491.07
GPX2,960,4731.14
GeoJSON (compact)3,139,0631.20
GeoJSONSeq (NDJSON)3,141,1771.20
KML3,145,9431.21
GeoJSON (pretty)3,392,3041.30
TopoJSON (arcs)4,434,3261.70

The size range before and after gzip

Figure 4. Each dot is one format. Before compression the formats span 6.38–45.39 MB; after gzip -6 they cluster between 2.61 and 3.39 MB, with one outlier.

The uncompressed spread is 7.1×. After gzip it is 1.30× if the arc-encoded outlier is excluded. Deflate eats repeated structure for breakfast: "type":"Feature", "geometry", <Placemark>, indentation whitespace, and the shared leading digits of clustered longitudes all collapse into short back-references. The remaining difference is dominated by the payload that actually varies — the names and the coordinate digits.

This has a practical consequence that is easy to get wrong. If the output is going to be served over HTTP with content encoding, the choice of format barely affects transfer size. But a browser-local converter does not compress its output before creating a Blob. The object sitting in the tab's heap is 45.4 MB of JavaScript string for pretty GeoJSON, or 23.7 MB for compact, regardless of what a CDN would do with it. Format choice is therefore a memory decision first and a network decision second — the opposite of the usual server-side intuition.

It is also why the "pretty" option costs twice: not because anyone will download a larger file (gzip narrows the difference to 0.25 MB), but because the intermediate string is twice as large in memory.

6. Result three: time on the main thread

Serialization timings (milliseconds, median of five for the two smallest sizes, single pass for the two largest):

Representation1,00010,00050,000199,031
CSV1.29.8120.6222.5
GeoJSON (compact)3.520.891.9493.1
GeoJSON (pretty)1.417.9104.2955.1
GeoJSONSeq (NDJSON)2.320.7258.6825.4
KML0.76.439.3161.7
GPX0.86.232.1143.9
WKT + attributes0.54.822.691.8
TopoJSON (arcs)1.212.970.5351.0

These Python numbers are noisy at small sizes — the 1,000-row column is within measurement error — but the large column is stable enough to show that string concatenation beats object construction. GPX and KML build strings directly and finish in ~150 ms; the JSON writers first allocate 199,031 dictionaries, then ask json.dumps to walk that object graph, and take 3–6 times longer. Pretty-printing adds another ~460 ms on top of compact JSON.

Parsing back is a different picture:

Rowsjson.loads on GeoJSONline-by-line NDJSON
1,0000.72 ms0.92 ms
10,0007.78 ms9.06 ms
50,00059.11 ms43.82 ms

At 50,000 rows, per-line parsing becomes faster than parsing one giant document, even though it invokes the JSON parser 50,000 times. It also allows incremental handling: a stream can emit the first result before the last line arrives. That is the real argument for GeoJSONSeq in a browser pipeline, not its byte count.

On the JavaScript side I wrote the largest compact GeoJSON to disk and parsed it with Node 22:

const fs = require('node:fs');
const buf = fs.readFileSync('largest.geojson');   // 23,699,552 bytes
const t0 = performance.now();
const fc = JSON.parse(buf.toString('utf8'));
console.log(fc.features.length, (performance.now() - t0).toFixed(1), 'ms');
// 199031 108.4 ms (median of 5: 106.1, 107.4, 108.4, 139.4, 174.3)

Parsing 1,000 features takes a median of 0.35 ms. Parsing all 199,031 takes 108.4 ms — roughly six dropped frames at 60 Hz, before any geometry work happens. In a browser this is exactly the kind of task that belongs in a Worker:

// worker.ts — serialization stays off the main thread
self.onmessage = (e: MessageEvent<{ rows: Row[]; format: string }>) => {
  const { rows, format } = e.data;
  const bytes = serialize(rows, format);          // Uint8Array
  self.postMessage({ bytes }, [bytes.buffer]);    // transfer, do not copy
};
// main thread
const worker = new Worker(new URL('./worker.ts', import.meta.url));
worker.onmessage = ({ data }) => {
  const blob = new Blob([data.bytes], { type: 'application/geo+json' });
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'villages.geojson';
  a.click();
  setTimeout(() => URL.revokeObjectURL(url), 60_000); // otherwise the Blob stays alive
};

The revokeObjectURL call is not cosmetic. Until it runs, the browser retains the entire output Blob; a user who converts five large files in one tab can hold hundreds of megabytes without anything appearing to be "open".

7. Result four: rounding coordinates is a bad trade

A common size tip is to round coordinates to fewer decimal places. I measured it on 10,000 real points, using the compact GeoJSON size at full precision (1,196,741 bytes) as the baseline, and computing the displacement with the haversine formula on a sphere of radius 6,371,008.8 m:

Decimal placesBytesSavedMax errorMean error
8 (source)1,196,7410.00%0 m0 m
71,186,7230.84%0.006 m0.003 m
61,176,6711.68%0.056 m0.028 m
51,156,7223.34%0.724 m0.389 m
41,136,7865.01%7.165 m3.903 m
31,116,8516.68%72.485 m39.084 m
from math import radians, sin, cos, asin, sqrt

def haversine(lon1, lat1, lon2, lat2, r=6_371_008.8):
    p1, p2 = radians(lat1), radians(lat2)
    dp, dl = p2 - p1, radians(lon2 - lon1)
    a = sin(dp/2)**2 + cos(p1)*cos(p2)*sin(dl/2)**2
    return 2 * r * asin(sqrt(a))

errors = [haversine(lon, lat, round(lon, nd), round(lat, nd))
          for _, lon, lat in sample_rows]

Coordinate precision versus size saving and positional error

Figure 5. Blue bars show bytes saved (linear axis); the orange line shows maximum positional error (logarithmic axis).

Six decimal places is the sweet spot for most mapping work: it keeps the worst displacement under 6 cm and saves only 1.68%. Three decimal places saves 6.68% — about 80 KB on this sample — and moves a point by up to 72.5 m, enough to put a village on the wrong side of a road. Rounding is one of the worst size optimisations available, because the bytes it removes are the cheap, highly compressible ones, while the accuracy it removes is the thing the data exists to preserve. Gzip already recovers most of those bytes for free; it cannot recover the lost precision.

If size really matters, drop attributes you do not need, use a binary geometry encoding, or stream — do not truncate coordinates.

8. The TopoJSON surprise

I expected the arc-encoded representation to be smaller. It was not. At 199,031 points it produced 21,107,270 raw bytes — slightly smaller than compact GeoJSON — but 4,434,326 bytes after gzip, which is 41% larger than GeoJSON's 3,139,063 and the worst compressed result in the table.

The reason is structural. TopoJSON earns its size by deduplicating shared boundaries between adjacent polygons: an arc is stored once and referenced by both neighbours. A point dataset has no shared geometry at all. Every arc here contains exactly one delta-encoded coordinate, and the arcs array becomes a second, redundant copy of the coordinates already present in the objects collection. Quantizing to 1e-6 and delta-encoding also randomises the digit patterns that deflate was exploiting in the plain decimal coordinates, so the compressed result gets worse on both counts.

This is a useful negative result: TopoJSON is a topology optimisation, not a general compression format. Applying it to point clouds is actively harmful. It shines on administrative boundaries, cadastral parcels, and any polygonal coverage where neighbours share edges. I kept the result in the article precisely because it contradicts the usual "TopoJSON is smaller" shorthand.

9. What this means in a real browser tab

The browser-local conversion pipeline

Figure 6. Five stages, one network boundary. Static assets cross it; the user's file never does.

A client-side conversion has five stages: obtain the File, read it into an ArrayBuffer, parse it, serialize the target representation, and create a downloadable Blob. The first four each hold a full copy of something. For the 199,031-row case, the plausible peak is the source bytes (6.4 MB) plus the parsed object graph (well over 23 MB once Python/JS object overhead is counted) plus the serialized string (23.7 MB for compact GeoJSON) plus the Blob — comfortably over 60 MB for a single conversion, before the GDAL WASM heap is considered.

Practical rules that follow from the measurements:

  1. Never pretty-print the export. It doubles the intermediate string for no user-visible benefit; show a formatted preview of the first three features instead.
  2. Move serialization to a Worker. The 108 ms JSON parse measured in Node is a floor, not a ceiling; a slower device will multiply it.
  3. Prefer line-delimited output for large jobs. At 50,000 rows, NDJSON was faster to parse than a single document and can be produced incrementally.
  4. Budget the Blob lifetime. Revoke object URLs, and do not keep the output string in React state — that pins a second copy.
  5. Do not optimise bytes by rounding coordinates. The measurement above shows the trade is bad.

The network boundary is worth restating: with this architecture the only requests are for HTML, JS, CSS, and the GDAL WASM binary. No request carries the user's file. That is why the memory and main-thread costs are worth measuring at all — they are the price of the privacy property, and they are paid locally rather than on someone else's server.

10. Limitations, stated plainly

11. Reproduce it

The fixtures are real files in the project's test data, and comparable public samples are available on the sample data page. To reproduce:

# Python 3.10+; no third-party packages required
python3 - <<'PY'
import csv, io, gzip, json
raw = open('村名.csv', 'rb').read().decode('gbk')
rows = [r for r in list(csv.reader(io.StringIO(raw)))[1:] if len(r) == 3]
sample = rows[:10_000]
fc = {'type': 'FeatureCollection', 'features': [
    {'type': 'Feature', 'properties': {'name': r[0]},
     'geometry': {'type': 'Point', 'coordinates': [float(r[1]), float(r[2])]}}
    for r in sample]}
b = json.dumps(fc, ensure_ascii=False, separators=(',', ':')).encode('utf-8')
print(len(b), len(gzip.compress(b, 6, mtime=0)))
# 1196741 161376  (10,000 rows, compact GeoJSON, gzip -6)
PY

If that prints 1196741 161376, your encoder settings match the table. If it prints a much larger first number, ensure_ascii is still at its default.

12. Where to go next

If you want to try the conversions these numbers came from, these tools run entirely in the browser:

A short FAQ to close:

Is GeoJSON always the wrong choice for large data? No. At 199,031 points it is 23.7 MB uncompressed and 3.14 MB compressed, parses in ~108 ms in Node, and is understood by essentially every web mapping library. The 3.14 MB transfer is unremarkable. The cost is in-memory, and only matters if you build the whole thing at once.

Should I stream instead? For datasets much larger than this one, yes — line-delimited features let you release each record as you go, and the 50,000-row parse result shows the approach is competitive even before considering memory. For 199,031 points on a modern device, a Worker plus a compact writer is usually enough.

Why not just use a binary format? Geopackage, FlatGeobuf, and WKB are all smaller and faster for large datasets. They are also harder to inspect, harder to debug, and not directly consumable by most JavaScript mapping libraries. The eight representations here are the ones a browser-based converter is most often asked to produce.

The headline is simple: format choice changes the size of the object in your tab by seven times, changes the size on the wire by about thirty percent, and changes serialization time by a factor of six. Optimise for the tab, not for the wire.