GEOJSON MIME Type – Free, Online, Private
application/geo+json is the RFC 7946 type for GeoJSON. Coordinates are longitude then latitude, in WGS 84.
What .geojson is
GeoJSON is a JSON document with a geographic vocabulary. The root has a type such as Feature, FeatureCollection, or a geometry name. Coordinates are in WGS 84, longitude then latitude, not the latitude-first order many people say out loud. RFC 7946 registers application/geo+json and obsoletes application/vnd.geo+json. The body is UTF-8 JSON. As with application/json, do not invent a charset parameter. A file that is generic JSON without a GeoJSON type member is application/json, not this type.
IANA registers application/geo+json in RFC 7946. The older application/vnd.geo+json value is obsolete. The media type is application/geo+json. Extensions that use it on this page: .geojson. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.
What sends application/geo+json
What sends application/geo+json: Send application/geo+json for a .geojson response a map client will load. Browsers do not render it natively. A map library parses it. If you also serve the same features as vector tiles or as KML, those are different URLs and different types. application/vnd.google-earth.kml+xml is not a substitute header for a GeoJSON body. Range requests are useful for a large FeatureCollection only if the client can use a slice. Most clients cannot. They read the whole document. Compress with Content-Encoding: gzip. The type stays application/geo+json. The file on disk is still .geojson. Once the response exists, a client trusts application/geo+json, not the filename. If you generate GeoJSON from a database, set the SRID conversion in the query so the numbers really are WGS 84. Labeling a projected coordinate system as application/geo+json does not reproject it. The client will draw the geometry on the wrong part of the planet.
Content-Type for .geojson
Send application/geo+json with no charset parameter. The registration either defines no charset parameter or tells clients to ignore one, and the payload is UTF-8 by rule rather than by a parameter. Adding charset=utf-8 looks helpful and has broken strict parsers.
Content-TypeContent-Type: application/geo+json
nginx, Apache, and Express
These snippets map .geojson to application/geo+json. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .geojson so a stale mime database in the framework cannot disagree with the type on this page.
nginx# /etc/nginx/mime.types, inside the types { } block
application/geo+json geojson;
ApacheAddType application/geo+json .geojson
Expressimport express from "express";
const app = express();
app.use(express.static("public", {
setHeaders(res, filePath) {
if (filePath.endsWith(".geojson")) {
res.setHeader("Content-Type", "application/geo+json");
}
},
}));
Pitfalls for application/geo+json
Pitfalls that show up for application/geo+json, and not for a neighboring type with a similar extension: Swapping coordinate order puts every point in the wrong place and the file remains valid GeoJSON. The type will not catch it. Another trap is a bounding box that does not contain the coordinates, which clients use to skip a fetch and then show nothing. Another is a FeatureCollection so large that JSON.parse blocks the page. Split it or use a tiled format. A fourth is serving the obsolete vnd.geo+json type. Update it. A fifth is NaN or Infinity in a coordinate. JSON does not allow those tokens. Emit null or omit the feature.
- application/geo+json is the current type. application/vnd.geo+json is obsoleted by RFC 7946.
- The axis order is longitude, latitude. A map that looks mirrored is often this bug.
- CRS members from older drafts are out of the current spec. Do not depend on them.
- A UTF-8 BOM before the first brace breaks strict JSON parsers. Do not write one.
Frequently asked questions
Which type is current?
application/geo+json, from RFC 7946. The vnd.geo+json type is obsolete.
What order are the coordinates?
Longitude, then latitude. Both are WGS 84 decimal degrees.
Should I send charset=utf-8?
No. Leave the parameter off, as with other JSON types. The text is UTF-8.
Will a browser draw the map?
No. The type identifies the JSON vocabulary. A map library has to render it.