FleetbaseFleetbase

CoordinatesInput

<CoordinatesInput> renders side-by-side lat/lng fields with a map-picker dropdown that supports drag-to-place and address geocoding.

<CoordinatesInput>

Lets a user enter or pick a geographic coordinate. Renders two text inputs (latitude and longitude) plus a "Select from map" dropdown that opens a Leaflet map with a draggable marker and an address-lookup field.

For binding directly to an Ember Data record, see the sibling <ModelCoordinatesInput> (same component, but updates record.location automatically).

Basic Usage

<CoordinatesInput
  @latitude={{this.driver.lat}}
  @longitude={{this.driver.lng}}
  @onUpdate={{this.handleCoordsChange}}
/>
@action handleCoordsChange(lat, lng) {
  this.driver.lat = lat;
  this.driver.lng = lng;
}

With Address Lookup

The map picker includes an address search field — type an address, click Lookup, and the marker jumps to the geocoded location.

Arguments

ArgumentTypeDescription
@latitudenumberLatitude in decimal degrees
@longitudenumberLongitude in decimal degrees
@onUpdate(lat, lng)Called when either coordinate changes
@disabledbooleanDisable input and dropdown
@renderInPlacebooleanRender the dropdown in DOM order (default: true)
@triggerClassstringExtra classes on the "Select from map" trigger
@mapContainerClassstringExtra classes on the map container
@leafletMapClassstringExtra classes on the Leaflet map
@zoomControlClass / @zoomControlContainerClassstringExtra classes on the zoom buttons

Real-World Examples

<InputGroup @name="Pickup location">
  <CoordinatesInput
    @latitude={{this.location.lat}}
    @longitude={{this.location.lng}}
    @onUpdate={{this.handleCoordsChange}}
  />
</InputGroup>

See Also

  • <ModelCoordinatesInput> — same component, but bound to a Fleetbase model's location polygon

Source

FileDescription
addon/components/coordinates-input.hbsTemplate
addon/components/coordinates-input.jsClass — uses Leaflet via the leaflet service
addon/components/model-coordinates-input.hbsSibling — bound to a Fleetbase model's location
addon/components/model-coordinates-input.js
CoordinatesInput | Fleetbase