• Stars
    star
    209
  • Rank 188,325 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

πŸ”₯ πŸƒ Easy and declarative mapping for ember

ember-leaflet CI Ember Observer Score npm version

Ember-Leaflet aims to make working with Leaflet layers in your Ember app as easy, declarative and composable as templates make working with DOM.

Installation

Ember Leaflet works in Ember 3.16+ with no deprecations.

To install it run:

ember install ember-leaflet

This will also add the leaflet package to your project.

ember-leaflet is compatible with leaflet 0.7+. If you need to use a legacy version, you can just install it via npm / yarn:

npm install --save-dev [email protected]
yarn add -D [email protected]

Support, Questions, Collaboration

Discord Join Ember on Discord

Usage

Documentation and examples are hosted at https://miguelcobain.github.io/ember-leaflet/. Please file any issues if you see that something can be improved.

Production Builds

In your ember-cli-build.js add the following snippet:

let app = new EmberApp(defaults, {
  // Add options here
  fingerprint: {
    exclude: [
      'images/layers-2x.png',
      'images/layers.png',
      'images/marker-icon-2x.png',
      'images/marker-icon.png',
      'images/marker-shadow.png'
    ]
  }
});

ember-cli does fingerprinting (appending an md5 checksum to the end of every file) for production builds by default (http://ember-cli.com/user-guide/#fingerprinting-and-cdn-urls). Exclude the leaflet assets so that your production build produces them correctly.

Overview

Web apps frequently need to display geographic data, especially if it has a direct relationship with the real world. That isn't new, and has been done previously in all kinds of formats, particularly with raster and vector data.

Ember apps naturally may have the same requirements and until now, devs have been either using mapping libraries outside of ember scope, or using previous versions of ember-leaflet.

The problem was that both approaches were hard. Frequently existing libraries have regular javascript imperative APIs and html in mind. We all know and love how ember makes us flow the data in our app. Previous approaches simply didn't fit where ember really shines: templates, actions, routing, and above all, expressiveness.

Ember-leaflet allows you to express your maps right in your templates. Also, it is streamlined for ember in general. You have things like actions, components and the ability to use regular handlebars helpers like {{#if or {{#each.

We can't go wrong with delegating the mapping part to the battle tested, performant and lightweight Leaflet library.

So, let the mapping begin.

Examples

Think of your map as a set of layers inside a container. Your main container will be the <LeafletMap> component. This component creates the map container where your tiles, vectors and markers will be added to. Let's see an example of how it looks:

<LeafletMap @lat={{this.lat}} @lng={{this.lng}} @zoom={{this.zoom}} as |layers|>

  <layers.tile @url="http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png" />

  <layers.marker @location={{this.emberConfLocation}} as |marker|>
    <marker.popup>
      <h3>The Oregon Convention Center</h3>
      777 NE Martin Luther King Jr Blvd<br>
      Portland, OR 97232
    </marker.popup>
  </layers.marker>

  <layers.marker @location={{this.hotel}} as |marker|>
    <marker.popup>
      <h3>Hotel</h3>
    </marker.popup>
  </layers.marker>

</LeafletMap>

Linting

  • npm run lint:js
  • npm run lint:js -- --fix

Running tests

  • ember test – Runs the test suite on the current Ember version
  • ember test --server – Runs the test suite in "watch mode"
  • ember try:each – Runs the test suite against multiple Ember versions

Running the dummy application

For more information on using ember-cli, visit https://ember-cli.com/.

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.

More Repositories

1

ember-paper

The Ember approach to Material Design.
JavaScript
885
star
2

ember-cli-selectize

An Ember and Selectize integration, packaged as an Ember-cli addon.
JavaScript
153
star
3

ember-css-transitions

Ember implementation of CSS Transitions. Just like ng-animate and react animation but for Ember :)
JavaScript
99
star
4

hapi-boilerplate

A Hapi boilerplate with Sequelize, Sequelize-CLI and node-config
JavaScript
74
star
5

ember-yeti-table

Yeti Table
JavaScript
61
star
6

ember-selectize

An Ember and Selectize integration.
JavaScript
47
star
7

ember-composability-tools

ember-composability-tools - Helpers for building a somewhat different kind of components.
JavaScript
39
star
8

ember-fullscreen

Fullscreen API packaged as an Ember service.
JavaScript
26
star
9

ember-paper-expansion-panel

Material expansion panels for ember-paper.
JavaScript
23
star
10

ember-dynamic-render-template

Render DOM from a template string.
JavaScript
14
star
11

ember-leaflet-2

Project moved to https://github.com/gabesmed/ember-leaflet
JavaScript
12
star
12

ember-data-cascade-delete

Cascade delete your relationships
JavaScript
8
star
13

ember-clerk

Integrates Clerk with Ember.js applications
JavaScript
7
star
14

ember-leaflet-google-tile-layer

Google's tile layers for ember-leaflet
JavaScript
6
star
15

ember-cli-element-closest-polyfill

Includes a polyfill for closest if needed
JavaScript
4
star
16

ember-empathy

Because every talk should end with an "ember install" slide.
JavaScript
4
star
17

ember-select

Advanced EmberJS select component
JavaScript
3
star
18

ember-fractals

An experiment -> Fractals in Ember.
JavaScript
3
star
19

solar-system-poc

JavaScript
3
star
20

ColabOT-Server

Web-Based Real-Time Collaborative Editor
Java
2
star
21

ember-sticky

Stick your divs
HTML
2
star
22

ember-cli-promises-polyfill

Includes a polyfill for promises if needed
JavaScript
2
star
23

pulsing-colors

JavaScript
1
star
24

IPapp

Instant Places application generator
JavaScript
1
star
25

ember-cli-matchmedia-polyfill

Includes a polyfill for matchMedia if needed
JavaScript
1
star
26

ColabOT-Client

Client
JavaScript
1
star
27

IP.API

Instant Places API Javascript Client
JavaScript
1
star
28

ember-cli-polyfill-importer

A general purpose polyfill/script importer for ember-cli
JavaScript
1
star
29

IP.UI

UI Components for Public Display Web Applications
JavaScript
1
star
30

ember-leaflet-rotated-marker

Extends marker layers to support rotation
JavaScript
1
star
31

jalphabet

The Java Alphabet Library (JAL) - Custom alphabet manipulation library
Java
1
star
32

ember-canvas

JavaScript
1
star