What is MIME type "application/geo+json"?

A MIME type is a string that tells browsers and other tools how to handle a particular kind of file.

application/geo+json carries geographic data encoded in JSON. It stores spatial features like points, lines, and polygons.
This MIME type lets programs exchange map information easily. It follows JSON structure to represent coordinates and properties.
Files using this format, such as GEOJSON, are common in mapping apps and GIS tools.
Learn more about the standard at the GeoJSON official website.

Associated file extensions

Usage Examples

HTTP Header

When serving content with this MIME type, set the Content-Type header:


    Content-Type: application/geo+json    
  

HTML

In HTML, you can specify the MIME type in various elements:


    <a href="file.dat" type="application/geo+json">Download file</a>    
  

Server-side (Node.js)

Setting the Content-Type header in Node.js:


    const http = require('http');    
    
    http.createServer((req, res) => {    
      res.setHeader('Content-Type', 'application/geo+json');    
      res.end('Content here');    
    }).listen(3000);    
  

Associated file extensions

FAQs

What is the purpose of the application/geo+json MIME type?

It is the standard media type for GeoJSON data, as defined in RFC 7946. It indicates that the content is a JSON object specifically structured to represent geographic features, such as points, lines, and polygons, rather than generic data.

Should I use .json or .geojson for this MIME type?

You should generally use the geojson extension to clearly distinguish geographic data from other JSON files. While the file content is valid JSON, using the specific extension and MIME type ensures better compatibility with GIS software and mapping APIs.

How do I configure Apache to serve GeoJSON files correctly?

To ensure Apache sends the correct Content-Type header, add the following directive to your .htaccess file or main configuration: AddType application/geo+json .geojson. Without this, Apache might default to text/plain or application/json.

How do I enable application/geo+json in Nginx?

You can add the type to your mime.types file, typically located in /etc/nginx/. Add the line application/geo+json geojson; to the list. Alternatively, include types { application/geo+json geojson; } inside your specific server block.

Can I use application/json instead of application/geo+json?

Yes, many applications accept application/json because GeoJSON is syntactically identical to standard JSON. However, using application/geo+json is recommended by the official standard to explicitly signal to clients that the data contains spatial coordinates.

How do web browsers handle application/geo+json files?

Most browsers (like Chrome or Firefox) will render the raw text or prompt a download, as they do not have built-in map viewers. To visualize the data, you must consume the URL using JavaScript mapping libraries like Leaflet, OpenLayers, or Mapbox GL JS.

What is the difference between GeoJSON and KML?

GeoJSON uses a lightweight JSON structure optimized for web applications and JavaScript, while KML uses XML and is often associated with Google Earth. application/geo+json is generally preferred for modern web mapping due to its smaller size and ease of parsing.

Are there security risks associated with GeoJSON files?

GeoJSON is a text-based data format and does not execute code, making it generally safe. However, developers must sanitize data in the properties object before rendering it in a browser to prevent Cross-Site Scripting (XSS) attacks.

General FAQ

What is a MIME type?

A MIME (Multipurpose Internet Mail Extensions) type is a standard that indicates the nature and format of a document, file, or assortment of bytes. MIME types are defined and standardized in IETF's RFC 6838.

MIME types are important because they help browsers and servers understand how to process a file. When a browser receives a file from a server, it uses the MIME type to determine how to display or handle the content, whether it's an image to display, a PDF to open in a viewer, or a video to play.

MIME types consist of a type and a subtype, separated by a slash (e.g., text/html, image/jpeg, application/pdf). Some MIME types also include optional parameters.

How do I find the MIME type for a file?

You can check the file extension or use a file identification tool such as file --mime-type on the command line. Many programming languages also provide libraries to detect MIME types.

Why are multiple MIME types listed for one extension?

Different applications and historical conventions may use alternative MIME identifiers for the same kind of file. Showing them all helps ensure compatibility across systems.