Skip to contents

Indoor data commonly use either geographic coordinates tied to the Earth or local Cartesian coordinates tied only to a floor plan. These are separate workflows and are never converted into each other automatically.

Geographic coordinates

For an ordinary Leaflet map, sf data must have a declared CRS. Projected and geographic data are transformed to EPSG:4326 before serialization.

leaflet(indoor_demo_geo) |>
  addIndoor(label = ~name, style = list(fillColor = ~fill)) |>
  addIndoorControl()

GeoJSON follows the same longitude and latitude interpretation. Geographic longitude must be in [-180, 180] and latitude in [-90, 90].

Local Cartesian coordinates

Local plans use L.CRS.Simple. The sf CRS must be undefined and crs = "simple" makes the coordinate interpretation explicit. The x coordinate is passed as Leaflet longitude and y as Leaflet latitude, which is how L.CRS.Simple represents a Cartesian plane.

leaflet(
  indoor_demo,
  options = leafletOptions(
    crs = leafletCRS(crsClass = "L.CRS.Simple"),
    minZoom = -2
  )
) |>
  addIndoor(
    label = ~name,
    style = list(fillColor = ~fill),
    crs = "simple"
  ) |>
  addIndoorControl(position = "bottomright")

The package does not assign a CRS to a local plan, georeference an image, or guess a transformation. Users who need a geographic map must establish that relationship from authoritative control points outside leaflet.indoor.

Proxies

A leafletProxy() object does not contain the rendered map’s CRS options. Geographic sf data with a declared CRS remain unambiguous. Local sf data without a CRS require crs = "simple" when added through a proxy.