CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-schema-dts

TypeScript definitions and generator for Schema.org vocabulary with strongly-typed JSON-LD support

Pending
Overview
Eval results
Files

place-location.mddocs/

Place and Location Types

Schema.org types for geographic locations, venues, businesses, addresses, and spatial relationships.

Capabilities

Place Base Type

The root type for all locations and geographic entities.

/**
 * Entities that have a somewhat fixed, physical extension
 */
type Place = PlaceLeaf | Accommodation | AdministrativeArea | CivicStructure |
  Landform | LandmarksOrHistoricalBuildings | LocalBusiness | Residence |
  TouristAttraction | TouristDestination | string;

interface PlaceBase extends ThingBase {
  /** A property-value pair representing an additional characteristic of the entity */
  additionalProperty?: SchemaValue<PropertyValue, "additionalProperty">;
  /** Physical address of the item */
  address?: SchemaValue<PostalAddress | Text, "address">;
  /** The overall rating, based on a collection of reviews or ratings, of the item */
  aggregateRating?: SchemaValue<AggregateRating, "aggregateRating">;
  /** An amenity feature (e.g. a characteristic or service) of an Accommodation */
  amenityFeature?: SchemaValue<LocationFeatureSpecification, "amenityFeature">;
  /** A short textual code (also called "store code") that uniquely identifies a place of business */
  branchCode?: SchemaValue<Text, "branchCode">;
  /** The basic containment relation between a place and one that contains it */
  containedInPlace?: SchemaValue<Place, "containedInPlace">;
  /** The basic containment relation between a place and another that it contains */
  containsPlace?: SchemaValue<Place, "containsPlace">;
  /** Upcoming or past event associated with this place, organization, or action */
  event?: SchemaValue<Event, "event">;
  /** The fax number */
  faxNumber?: SchemaValue<Text, "faxNumber">;
  /** The geo coordinates of the place */
  geo?: SchemaValue<GeoCoordinates | GeoShape, "geo">;
  /** Represents a relationship between two geometries (or the places they represent) */
  geoContains?: SchemaValue<GeospatialGeometry | Place, "geoContains">;
  /** Represents a relationship between two geometries (or the places they represent) */
  geoCoveredBy?: SchemaValue<GeospatialGeometry | Place, "geoCoveredBy">;
  /** Indicates whether some facility (e.g. FoodEstablishment, CovidTestingFacility) offers a service that can be used by driving through in a car */
  hasDriveThruService?: SchemaValue<Boolean, "hasDriveThruService">;
  /** A URL to a map of the place */
  hasMap?: SchemaValue<Map | URL, "hasMap">;
  /** A flag to signal that the item, event, or place is accessible for free */
  isAccessibleForFree?: SchemaValue<Boolean, "isAccessibleForFree">;
  /** The International Standard of Industrial Classification of All Economic Activities (ISIC), Revision 4 code for a particular organization, business person, or place */
  isicV4?: SchemaValue<Text, "isicV4">;
  /** Keywords or tags used to describe this content */
  keywords?: SchemaValue<DefinedTerm | Text | URL, "keywords">;
  /** The latitude of a location */
  latitude?: SchemaValue<Number | Text, "latitude">;
  /** An associated logo */
  logo?: SchemaValue<ImageObject | URL, "logo">;
  /** The longitude of a location */
  longitude?: SchemaValue<Number | Text, "longitude">;
  /** The total number of individuals that may attend an event or venue */
  maximumAttendeeCapacity?: SchemaValue<Integer, "maximumAttendeeCapacity">;
  /** The opening hours of a certain place */
  openingHoursSpecification?: SchemaValue<OpeningHoursSpecification, "openingHoursSpecification">;
  /** A photograph of this place */
  photo?: SchemaValue<ImageObject | Photograph, "photo">;
  /** A flag to signal that the Place has a public toilet */
  publicAccess?: SchemaValue<Boolean, "publicAccess">;
  /** A review of the item */
  review?: SchemaValue<Review, "review">;
  /** Indicates whether it is allowed to smoke in the place */
  smokingAllowed?: SchemaValue<Boolean, "smokingAllowed">;
  /** The special opening hours of a certain place */
  specialOpeningHoursSpecification?: SchemaValue<OpeningHoursSpecification, "specialOpeningHoursSpecification">;
  /** The telephone number */
  telephone?: SchemaValue<Text, "telephone">;
}

Administrative Area Types

Types for political and administrative geographical divisions.

/**
 * A geographical region, typically under the jurisdiction of a particular government
 */
type AdministrativeArea = AdministrativeAreaLeaf | City | Country | 
  SchoolDistrict | State | string;

/**
 * A city or town
 */
type City = CityLeaf | string;

/**
 * A country
 */
type Country = CountryLeaf | string;

/**
 * A state or province of a country
 */
type State = StateLeaf | string;

Usage Examples:

import type { Place, City, Country, State } from "schema-dts";

// Basic place with coordinates
const landmark: Place = {
  "@type": "Place",
  name: "Golden Gate Bridge",
  geo: {
    "@type": "GeoCoordinates",
    latitude: 37.8199,
    longitude: -122.4783
  },
  address: {
    "@type": "PostalAddress",
    addressLocality: "San Francisco",
    addressRegion: "CA",
    addressCountry: "US"
  }
};

// City with details
const city: City = {
  "@type": "City", 
  name: "New York",
  alternateName: "NYC",
  containedInPlace: {
    "@type": "State",
    name: "New York"
  },
  geo: {
    "@type": "GeoCoordinates",
    latitude: 40.7128,
    longitude: -74.0060
  }
};

// Country information
const country: Country = {
  "@type": "Country",
  name: "United States",
  alternateName: "USA"
};

Accommodation Types

Types for lodging and temporary residence facilities.

/**
 * An accommodation is a place that can accommodate human beings
 */
type Accommodation = AccommodationLeaf | Apartment | CampingPitch | House |
  Room | Suite | string;

interface AccommodationBase extends PlaceBase {
  /** An amenity feature (e.g. a characteristic or service) of an Accommodation */
  amenityFeature?: SchemaValue<LocationFeatureSpecification, "amenityFeature">;
  /** The size of the accommodation, e.g. in square meter or squarefoot */
  floorSize?: SchemaValue<QuantitativeValue, "floorSize">;
  /** The total integer number of bathrooms in some Accommodation */
  numberOfBathroomsTotal?: SchemaValue<Integer, "numberOfBathroomsTotal">;
  /** The total integer number of bedrooms in some Accommodation */
  numberOfBedrooms?: SchemaValue<Number | QuantitativeValue, "numberOfBedrooms">;
  /** Number of full bathrooms - The total number of full and ¾ bathrooms in an Accommodation */
  numberOfFullBathrooms?: SchemaValue<Number, "numberOfFullBathrooms">;
  /** Number of partial bathrooms - The total number of half and ¼ bathrooms in an Accommodation */
  numberOfPartialBathrooms?: SchemaValue<Number, "numberOfPartialBathrooms">;
  /** The number of rooms (excluding bathrooms and closets) of the accommodation or lodging business */  
  numberOfRooms?: SchemaValue<Number | QuantitativeValue, "numberOfRooms">;
  /** Indications regarding the permitted use of the accommodation */
  permittedUsage?: SchemaValue<Text, "permittedUsage">;
  /** A page providing information on how to book a tour of some Place */
  tourBookingPage?: SchemaValue<URL, "tourBookingPage">;
}

/**
 * A furnished accommodation, such as an apartment or house, offered for short-term rental or sale
 */
type Apartment = ApartmentLeaf | string;

/**
 * A house is a building or structure that has the ability to be occupied for habitation by humans
 */
type House = HouseLeaf | SingleFamilyResidence | string;

/**
 * A room is a distinguishable space within a structure, usually separated from other spaces by interior walls
 */
type Room = RoomLeaf | HotelRoom | MeetingRoom | string;

Usage Examples:

import type { Apartment, House, Room } from "schema-dts";

// Rental apartment listing
const rentalApartment: Apartment = {
  "@type": "Apartment",
  name: "Downtown Studio Apartment",
  address: {
    "@type": "PostalAddress",
    streetAddress: "123 Main Street, Apt 4B", 
    addressLocality: "San Francisco",
    addressRegion: "CA",
    postalCode: "94102",
    addressCountry: "US"
  },
  numberOfRooms: 2,
  numberOfBedrooms: 1,
  numberOfBathroomsTotal: 1,
  floorSize: {
    "@type": "QuantitativeValue",
    value: 600,
    unitCode: "SQF"
  },
  amenityFeature: [
    {
      "@type": "LocationFeatureSpecification",
      name: "Air Conditioning"
    },
    {
      "@type": "LocationFeatureSpecification", 
      name: "Laundry"
    }
  ]
};

// Single family house
const familyHome: House = {
  "@type": "SingleFamilyResidence",
  name: "Colonial Style Home",
  address: {
    "@type": "PostalAddress",
    streetAddress: "456 Oak Avenue",
    addressLocality: "Suburbs",
    addressRegion: "TX", 
    postalCode: "75001",
    addressCountry: "US"
  },
  numberOfBedrooms: 4,
  numberOfBathroomsTotal: 3,
  numberOfFullBathrooms: 2,
  numberOfPartialBathrooms: 1,
  floorSize: {
    "@type": "QuantitativeValue",
    value: 2400,
    unitCode: "SQF"
  }
};

Civic Structure Types

Types for public buildings and infrastructure.

/**
 * A public structure, such as a town hall or concert hall
 */
type CivicStructure = CivicStructureLeaf | Airport | Aquarium | Beach |
  BoatTerminal | Bridge | BusStation | BusStop | Campground | Cemetery |
  Crematorium | EducationalOrganization | EventVenue | FireStation |
  GovernmentBuilding | Hospital | MovieTheater | Museum | MusicVenue |
  Park | ParkingFacility | PerformingArtsTheater | PlaceOfWorship |
  Playground | PoliceStation | PublicToilet | RVPark | StadiumOrArena |
  SubwayStation | TaxiStand | TrainStation | Zoo | string;

/**
 * An airport
 */
type Airport = AirportLeaf | string;

interface AirportBase extends CivicStructureBase {
  /** IATA identifier for an airline or airport */
  iataCode?: SchemaValue<Text, "iataCode">;
  /** ICAO identifier for an airline or airport */
  icaoCode?: SchemaValue<Text, "icaoCode">;
}

/**
 * A hospital
 */
type Hospital = HospitalLeaf | string;

/**
 * A museum
 */
type Museum = MuseumLeaf | string;

/**
 * A park
 */
type Park = ParkLeaf | string;

Usage Examples:

import type { Airport, Hospital, Museum, Park } from "schema-dts";

// Airport information
const airport: Airport = {
  "@type": "Airport",
  name: "San Francisco International Airport",
  iataCode: "SFO", 
  icaoCode: "KSFO",
  address: {
    "@type": "PostalAddress",
    addressLocality: "San Francisco",
    addressRegion: "CA",
    postalCode: "94128",
    addressCountry: "US"
  },
  telephone: "+1-650-821-8211"
};

// Hospital facility
const hospital: Hospital = {
  "@type": "Hospital",
  name: "General Hospital",
  address: {
    "@type": "PostalAddress",
    streetAddress: "1 Medical Center Drive",
    addressLocality: "City",
    addressRegion: "State",
    postalCode: "12345",
    addressCountry: "US"
  },
  telephone: "+1-555-0199",
  isAccessibleForFree: false
};

// Museum
const museum: Museum = {
  "@type": "Museum",
  name: "Museum of Modern Art",
  openingHoursSpecification: [
    {
      "@type": "OpeningHoursSpecification",
      dayOfWeek: ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"],
      opens: "10:00",
      closes: "17:30"
    },
    {
      "@type": "OpeningHoursSpecification", 
      dayOfWeek: ["Saturday", "Sunday"],
      opens: "10:00",
      closes: "18:00"
    }
  ],
  isAccessibleForFree: false
};

Geographic Coordinates and Shapes

Types for precise geographic positioning and area definitions.

/**
 * The geographic coordinates of a place or event
 */
type GeoCoordinates = GeoCoordinatesLeaf;

interface GeoCoordinatesBase extends StructuredValueBase {
  /** Physical address of the item */
  address?: SchemaValue<PostalAddress | Text, "address">;
  /** The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code */
  addressCountry?: SchemaValue<Country | Text, "addressCountry">;
  /** The elevation of a location (WGS 84) */
  elevation?: SchemaValue<Number | Text, "elevation">;
  /** The latitude of a location. For example 37.42242 (WGS 84) */
  latitude?: SchemaValue<Number | Text, "latitude">;
  /** The longitude of a location. For example -122.08585 (WGS 84) */
  longitude?: SchemaValue<Number | Text, "longitude">;
  /** The postal code. For example, 94043 */
  postalCode?: SchemaValue<Text, "postalCode">;
}

/**
 * The geographic shape of a place. A GeoShape can be described using several properties whose values are based on latitude/longitude pairs
 */
type GeoShape = GeoShapeLeaf | GeoCircle | GeospatialGeometry;

interface GeoShapeBase extends StructuredValueBase {
  /** Physical address of the item */
  address?: SchemaValue<PostalAddress | Text, "address">;
  /** The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code */
  addressCountry?: SchemaValue<Country | Text, "addressCountry">;
  /** A box is the area enclosed by the rectangle formed by two points */
  box?: SchemaValue<Text, "box">;
  /** A circle is the circular region of a specified radius centered at a specified latitude and longitude */
  circle?: SchemaValue<Text, "circle">;
  /** The elevation of a location (WGS 84) */
  elevation?: SchemaValue<Number | Text, "elevation">;
  /** A line is a point-to-point path consisting of two or more points */
  line?: SchemaValue<Text, "line">;
  /** A polygon is the area enclosed by a point-to-point path for which the starting and ending points are the same */
  polygon?: SchemaValue<Text, "polygon">;
  /** The postal code. For example, 94043 */
  postalCode?: SchemaValue<Text, "postalCode">;
}

Postal Address Type

Structured address information for physical locations.

/**
 * The mailing address
 */
type PostalAddress = PostalAddressLeaf;

interface PostalAddressBase extends ContactPointBase {
  /** The country. For example, USA. You can also provide the two-letter ISO 3166-1 alpha-2 country code */
  addressCountry?: SchemaValue<Country | Text, "addressCountry">;
  /** The locality in which the street address is, and which is in the region */
  addressLocality?: SchemaValue<Text, "addressLocality">;
  /** The region in which the locality is, and which is in the country */
  addressRegion?: SchemaValue<Text, "addressRegion">;
  /** The post office box number for PO box addresses */
  postOfficeBoxNumber?: SchemaValue<Text, "postOfficeBoxNumber">;
  /** The postal code. For example, 94043 */
  postalCode?: SchemaValue<Text, "postalCode">;
  /** The street address. For example, 1600 Amphitheatre Pkwy */
  streetAddress?: SchemaValue<Text, "streetAddress">;
}

Usage Examples:

import type { PostalAddress, GeoCoordinates, GeoShape } from "schema-dts";

// Complete postal address
const businessAddress: PostalAddress = {
  "@type": "PostalAddress",
  streetAddress: "1600 Amphitheatre Parkway",
  addressLocality: "Mountain View",
  addressRegion: "CA",
  postalCode: "94043",
  addressCountry: "US"
};

// Precise coordinates
const coordinates: GeoCoordinates = {
  "@type": "GeoCoordinates",
  latitude: 37.4224,
  longitude: -122.0856,
  elevation: 30,
  address: businessAddress
};

// Geographic area definition
const serviceArea: GeoShape = {
  "@type": "GeoShape",
  circle: "37.4224,-122.0856,10", // lat,lng,radius in km
  addressCountry: "US"
};

Install with Tessl CLI

npx tessl i tessl/npm-schema-dts

docs

core-types.md

creative-work.md

events.md

index.md

person-organization.md

place-location.md

products-commerce.md

roles-relationships.md

schema-generation.md

tile.json