# What Type of Geometry Is the GeoJSON Data?

//

Scott Campbell

GeoJSON is a popular format for encoding geographic data structures. In this article, we will explore the type of geometry that can be represented using GeoJSON data.

## Geometry Types

GeoJSON supports several geometry types, each representing a different kind of spatial object. These geometry types allow us to represent points, lines, and polygons on a map.

### Points

The Point geometry type represents a single location in space. It is defined by its coordinates, which specify the latitude and longitude of the point. For example, a GeoJSON Point representing the Empire State Building in New York City would have coordinates like this: [40.748817, -73.985428].

### Lines

The LineString geometry type represents a sequence of connected line segments. It is defined by an array of coordinate pairs that describe the vertices of the line. For example, a GeoJSON LineString representing a route from point A to point B would have an array of coordinates like this: [[x1, y1], [x2, y2], [x3, y3], ..].

### Polygons

The Polygon geometry type represents an enclosed area on the map. It is defined by an array of linear rings, where each ring is an array of coordinate pairs that describe the vertices of the ring.

The first ring represents the outer boundary of the polygon, while subsequent rings represent holes within the polygon. For example, a GeoJSON Polygon representing Central Park in New York City would have an array of rings like this: [ [[x1,y1], [x2,y2], [x3,y3], .], [[hx1,hx2], [hx3,hx4], [hx5,hx6], .] ].

## Multi-geometry Types

In addition to the basic geometry types, GeoJSON also supports multi-geometry types that allow us to represent collections of geometries. These multi-geometry types include:

• MultiPoint: Represents a collection of points.
• MultiLineString: Represents a collection of line strings.
• MultiPolygon: Represents a collection of polygons.

These multi-geometry types are defined by an array of geometries, where each geometry is defined using the corresponding basic geometry type.

## Collections

In addition to individual geometries and multi-geometries, GeoJSON also supports Collections. A GeoJSON Collection is an object that contains an array of features.

Each feature consists of a geometry and additional properties. This allows us to represent more complex spatial data structures.

## Conclusion

In this article, we have discussed the different types of geometry that can be represented using GeoJSON data. From points and lines to polygons and collections, GeoJSON provides a flexible and powerful way to encode geographic information. By understanding these geometry types, you can effectively work with GeoJSON data in your applications.