Skip to content
| Marketplace
Sign in
Visual Studio Code>Snippets>GeoJSON SnippetsNew to Visual Studio Code? Get it now.
GeoJSON Snippets

GeoJSON Snippets

Analytic Signal Limited

analyticsignal.com
|
18,403 installs
| (0) | Free
Create geospatial objects using GeoJSON snippets
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

GeoJSON Snippets

Create geospatial objects in GeoJSON format using Visual Studio Code snippets. This extension reduces the friction of creating and editing GeoJSON documents by providing snippets for creating every type of feature and geometry object.

GeoJSON Snippets Example of GeoJSON snippet usage.

Usage

All snippets provided by this extension are prefixed geo. See the Features section below for a full list of the available snippets.

Inserting GeoJSON snippets into your document is easy. Use either of the following methods:

Command Palette

  1. Choose Insert Snippet from the Command Palette.

  2. A list of snippets appears. You can type to filter the list; type geo to filter the list for GeoJSON snippets provided by this extension.

  3. Choose a snippet from the list and it is inserted into the document.

  4. Placeholders indicate the minimum coordinate data required to satisfy the GeoJSON schema. Use the tab key to step through the placeholders.

IntelliSense

  1. Start typing geo in your document to trigger IntelliSense for the GeoJSON snippets provided by this extension.

  2. The IntelliSense pop up will appear. You can further filter the pop up list by continuing to type.

  3. Choose a snippet from the pop up and it is inserted into the document.

  4. Placeholders indicate the minimum coordinate data required to satisfy the GeoJSON schema. Use the tab key to step through the placeholders.

You can also trigger IntelliSense by typing Ctrl+Space.

Features

GeoJSON Features

Snippets that insert GeoJSON feature objects. Feature objects contain both geometry and properties objects.

Inserted geometry objects contain placeholders for the minimum amount of coordinate data to satisfy the GeoJSON schema. Use the tab key to step through the placeholders. Add more coordinate items as required.

Inserted properties objects are empty by default but contain a placeholder for their content. Use the tab key to step through the placeholder. Add content as required, this is not subject to GeoJSON schema validation.

Prefix Description
geo.Point Insert Point feature
geo.LineString Insert LineString feature
geo.Polygon Insert Polygon feature
geo.MultiPoint Insert MultiPoint feature
geo.MulitLineString Insert MultiLineString feature
geo.MultiPolygon Insert MultiPolygon feature
geo.GeometryCollection Insert GeometryCollection feature
geo.FeatureCollection Insert FeatureCollection

GeoJSON Geometry

Snippets that insert GeoJSON geometry objects. Objects contain placeholders for the minimal amount of coordinate data to satisfy the GeoJSON schema. Use the tab key to step through the placeholders. Add more coordinate items as required.

One use case for geometry object snippets is to add items to a GeometryCollection.

Prefix Description
geo.Point geometry Insert Point geometry
geo.LineString geometry Insert LineString geometry
geo.Polygon geometry Insert Polygon geometry
geo.MultiPoint geometry Insert MultiPoint geometry
geo.MulitLineString geometry Insert MultiLineString geometry
geo.MultiPolygon geometry Insert MultiPolygon geometry
geo.GeometryCollection geometry Insert GeometryCollection geometry

GeoJSON Schema

Prefix Description
geo.schema Insert https link to the GeoJSON schema specification

GeoJSON Schema Validation

This extension ensures that files matching the (.geojson) file name extension are automatically validated against the GeoJSON schema.

Validation against the GeoJSON schema highlights any problems with your document due to inconsistencies with the schema specified here: https://geojson.org/schema/GeoJSON.json

Alternatively, you can insert a link to the schema in your document using the geo.schema snippet to obtain automatic GeoJSON validation. Use this approach if using other file name extensions, like (.json) for example.

Release Notes

File associations

From VSCode 1.61, GeoJSON (.geojson) files are automatically associated with the JSON (json) language and benefit from JSON editor features like syntax highlighting, formatting, and folding.

Setting file associations in earlier versions

In earlier versions of VSCode, the (.geojson) file name extension is not associated with the JSON (json) language or editor. The language mode defaults to Plain Text but it is strongly recommended to associate these files with the JSON language mode.

Make the association as follows:

  1. Open a (.geojson) file in an editor. The Status Bar indicates that the language mode is Plain Text.

  2. Click the Select Language Mode item in the Status Bar.

  3. Select JSON (json) from the list of languages.

Alternatively, you can make the same association by editing your settings.json file, as follows:

  1. Open the Command Palette.

  2. Select Preferences: Open Settings (JSON).

  3. The settings.json file opens in an editor; make the following addition:

"files.associations": {
    "*.geojson": "json"
}

The (.geojson) file name extension is now associated with the JSON editor, and files of this type will now benefit from JSON editor features like syntax highlighting, formatting, and folding.

Snippets and IntelliSense

When triggered, the default behaviour of IntelliSense is to show snippets along with other context dependent suggestions. This may result in a long list of suggestions in the IntelliSense pop-up, particularly if the geo snippet trigger matches other symbols in your editor.

It's easy to modify this behaviour using your Visual Studio Code settings. To access the relevant settings go to Preferences > Settings and type snippets in the Search settings field as shown below:

Snippets and IntelliSense settings

You can control whether snippets are shown with other suggestions and how they are sorted using the Editor: Snippet Suggestions dropdown. Choose one of the options to control how snippet suggestions are shown in the IntelliSense popup:

Option Intellisense
top Show snippet suggestions on top of other suggestions.
bottom Show snippet suggestions below other suggestions.
inline Show snippet suggestions with other suggestions (default).
none Do not show snippet suggestions.

You can also use the Editor > Suggest: Show Snippets checkbox to enable or disable snippets in IntelliSense suggestions. When snippets are disabled in IntelliSense they are still accessible through the Command Palette Insert Snippet command.

References

For more information about GeoJSON format visit geojson.org.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft