๐Ÿ“‹JSON Templates

GeoJSON Point Feature

GeoJSON format for representing geographic point data.

Explanation

GeoJSON is a standard format for encoding geographic data structures.

Examples

Single Point
Output
{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [
      20.4612,
      44.7866
    ]
  },
  "properties": {
    "name": "Belgrade",
    "country": "Serbia",
    "population": 1166763
  }
}
Feature Collection
Output
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          20.4612,
          44.7866
        ]
      },
      "properties": {
        "name": "Belgrade"
      }
    },
    {
      "type": "Feature",
      "geometry": {
        "type": "Point",
        "coordinates": [
          21.8955,
          43.3209
        ]
      },
      "properties": {
        "name": "Niลก"
      }
    }
  ]
}

Code Examples

TypeScript
interface GeoJSONPoint {
  type: 'Feature';
  geometry: {
    type: 'Point';
    coordinates: [number, number]; // [longitude, latitude]
  };
  properties?: Record<string, any>;
}

interface GeoJSONFeatureCollection {
  type: 'FeatureCollection';
  features: GeoJSONPoint[];
}

// Create point feature
function createPoint(lng: number, lat: number, properties = {}) {
  return {
    type: 'Feature',
    geometry: {
      type: 'Point',
      coordinates: [lng, lat]
    },
    properties
  };
}

Try it Now

๐Ÿ’ก Tips

  • Coordinates are [longitude, latitude] (not lat, lng!)
  • Use FeatureCollection for multiple features
  • Add properties for metadata
  • GeoJSON works with Leaflet, Mapbox, etc.
  • Validate with geojson.io

โš ๏ธ Common Pitfalls

  • Coordinate order is [lng, lat], not [lat, lng]
  • Coordinates must be numbers, not strings
  • Don't forget "type" fields
  • Large GeoJSON files can be slow