DevToolsmith

GEOJSON MIME Type

application/geo+json is the MIME type for GeoJSON geographic data. Here is the Content-Type header to send, the file signature, and how to configure servers and code.

MIME type
application/geo+json
Extensions
.geojson
Content-Type header
application/geo+json
Registered
Yes, with IANA
Compress with gzip
Yes, it is text or uncompressed
Category
Data and text

About GeoJSON files

GeoJSON (RFC 7946) describes points, lines and polygons as JSON, with coordinates in longitude, latitude order. Map libraries such as Leaflet, Mapbox GL and OpenLayers load it directly, and GitHub renders .geojson files as maps.

File signature

GEOJSON has no fixed signature: it is data without a magic number, so validate uploads by parsing the content rather than by checking bytes.

Serve .geojson with the right Content-Type

Response header
Content-Type: application/geo+json
nginx (a line in the types { } block of mime.types)
application/geo+json geojson;
Apache (.htaccess or server config)
AddType application/geo+json .geojson
Caddy
@geojson path *.geojson
header @geojson Content-Type "application/geo+json"
Check what a server sends
curl -sI https://example.com/file.geojson | grep -i '^content-type'
# Content-Type: application/geo+json

Set the type in code

Node.js (Express)
res.set('Content-Type', 'application/geo+json');
// Or make the browser download it:
res.attachment('file.geojson');
Python
import mimetypes

mimetypes.add_type('application/geo+json', '.geojson')  # if your system doesn't know it
mimetypes.guess_type('file.geojson')[0]  # 'application/geo+json'
Go
mime.AddExtensionType(".geojson", "application/geo+json")
w.Header().Set("Content-Type", "application/geo+json")

Accept .geojson uploads

HTML
<input type="file" accept=".geojson,application/geo+json">

The accept attribute only filters the file picker; users can still choose another file. Listing the extension as well as the type matters, because operating systems don’t always report the type you expect.

Related types

  • .json (application/json): JSON
  • .jsonld (application/ld+json): JSON-LD
  • .csv (text/csv): CSV

More data and text

.txt , .tsv , .md , .ndjson , .xml , .yaml , .ics , .sql . Look up any extension or type with the MIME type lookup.

Sources

Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.

Frequently asked questions

What is the MIME type for .geojson files?

application/geo+json. The full header is "Content-Type: application/geo+json".

Why does my server send the wrong Content-Type for .geojson?

Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .geojson is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".

How can I check that a file really is GEOJSON?

GEOJSON has no fixed file signature, so the extension and content are all you have. Check that the content is what you expect, for example by parsing it, before trusting an upload.