Git Product home page Git Product logo

leaflet-control-geocoder's Introduction

A few words on diversity in tech

I need to take some of your time. I can't believe we let shit like the Kathy Sierra incident or what happened to Brianna Wu happen over and over again. I can't believe we, the open source community, let sexist, misogynous shit happen over and over again.

I strongly believe that it is my — and your — duty to make the open source community, as well as the tech community at large, a community where everyone feel welcome and is accepted. At the very minimum, that means making sure the community and its forums both are safe, and are perceived as safe. It means being friendly and inclusive, even when you disagree with people. It means not shrugging off discussions about sexism and inclusiveness with handwaving about censorship and free speech. For a more elaborate document on what that means, the NPM Code of Conduct is a good start, Geek Feminism's resources for allies contains much more.

While I can't force anyone to do anything, if you happen to disagree with this, I ask of you not to use any of the open source I have published. Nor am I interested in contributions from people who can't accept or act respectfully towards other humans regardless of gender identity, sexual orientation, disability, ethnicity, religion, age, physical appearance, body size, race, or similar personal characteristics. If you think feminism, anti-racism or the LGBT movement is somehow wrong, disturbing or irrelevant, I ask you to go elsewhere to find software.

Leaflet Control Geocoder NPM version Leaflet 1.0.0 compatible!

A simple geocoder for Leaflet that by default uses OSM/Nominatim.

The plugin supports many different data providers:

The plugin can easily be extended to support other providers. Current extensions:

Demos

Usage

Download latest release, or obtain the latest release via unpkg.com:

<link rel="stylesheet" href="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.css" />
<script src="https://unpkg.com/leaflet-control-geocoder/dist/Control.Geocoder.js"></script>

Add the control to a map instance:

var map = L.map('map').setView([0, 0], 2);
L.tileLayer('https://{s}.tile.osm.org/{z}/{x}/{y}.png', {
  attribution: '&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.Control.geocoder().addTo(map);

Customizing

By default, when a geocoding result is found, the control will center the map on it and place a marker at its location. This can be customized by listening to the control's markgeocode event. To remove the control's default handler for marking a result, set the option defaultMarkGeocode to false.

For example:

var geocoder = L.Control.geocoder({
  defaultMarkGeocode: false
})
  .on('markgeocode', function(e) {
    var bbox = e.geocode.bbox;
    var poly = L.polygon([
      bbox.getSouthEast(),
      bbox.getNorthEast(),
      bbox.getNorthWest(),
      bbox.getSouthWest()
    ]).addTo(map);
    map.fitBounds(poly.getBounds());
  })
  .addTo(map);

This will add a polygon representing the result's boundingbox when a result is selected.

API

leaflet-control-geocoder's People

Contributors

andreaswc avatar arwystli avatar awem avatar benscott avatar birros avatar cyrille37 avatar danzel avatar davidpiesse avatar ent8r avatar frodrigo avatar gia90 avatar gjaldon avatar gregallensworth avatar guillaumeamat avatar jonaska avatar jwerts avatar keul avatar kristjanesperanto avatar liaanm avatar markaspot avatar neogeomat avatar nick59 avatar perliedman avatar quinnchr avatar sa3m avatar simon04 avatar talos avatar tomhughes avatar tsamaya avatar wqoq avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.