• Stars
    star
    510
  • Rank 86,627 (Top 2 %)
  • Language
    TypeScript
  • License
    BSD 2-Clause "Sim...
  • Created about 11 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

A simple geocoder form to locate places. Easily extended to multiple data providers.

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

More Repositories

1

leaflet-routing-machine

Control for routing in Leaflet
JavaScript
1,070
star
2

leaflet-realtime

Put realtime data on a Leaflet map
JavaScript
720
star
3

geojson-path-finder

Find shortest path through a network of GeoJSON
TypeScript
270
star
4

reproject

Change, convert, transform, reproject GeoJSON between different projections / CRS
JavaScript
212
star
5

query-overpass

Make queries to OpenStreetMap's overpass API and output as GeoJSON
JavaScript
147
star
6

raytracing-in-one-weekend

Rust implementation of the book Ray Tracing in One Weekend
Rust
94
star
7

tiled-maps

A short, free and open introduction to the concept of tiled maps
HTML
61
star
8

shadow-mapper

Generate maps of sun and shade from OpenStreetMap data
Python
56
star
9

elevation-service

Elevation data for your GeoJSON as a micro service
JavaScript
46
star
10

node-hgt

Query hgt files (typically SRTM elevation data) with performance
JavaScript
45
star
11

geojson-elevation

Add juicy elevation data to your fresh GeoJSON
JavaScript
38
star
12

ocad2geojson

JavaScript OCAD file reader and exporter for GeoJSON, SVG and Mapbox Style Spec
JavaScript
32
star
13

lrm-graphhopper

Support for GraphHopper in Leaflet Routing Machine
JavaScript
31
star
14

leaflet-underneath

Find interesting features is in your map using Mapbox Vector Tiles data
JavaScript
30
star
15

openlayers-routing-machine

A complete user interface for routing within an OpenLayers map
HTML
18
star
16

geojson2obj

Convert GeoJSON into Wavefront OBJ format
JavaScript
17
star
17

leaflet-touch-helper

Make it easy to touch things in Leaflet
JavaScript
17
star
18

osm-slope

Calculate slope (climb and descent) for highway ways in OpenStreetMap data.
JavaScript
17
star
19

svenska-landskap

Sveriges landskap som öppen geodata i GeoJSON
Shell
13
star
20

terrain-obj

Convert elevation data (typically SRTM elevation data, HGT files) to Wavefront OBJ 3D models
JavaScript
12
star
21

gis-nerd-tools

Simple but awesome web based tools for GIS enthusiasts
JavaScript
10
star
22

o-scout

A web based app for orienteering course setting and exploration
JavaScript
9
star
23

osmwave

Convert OpenStreetMap buildings and roads into Wavefront OBJ 3D models.
C++
7
star
24

leaflet-multi-style

Quickly add multiple styles to GeoJSON data
JavaScript
7
star
25

leaflet-raster

A simple Leaflet plugin for powerful raster functions
JavaScript
7
star
26

raster-blaster

Blast multi-band rasters to a canvas with speed and style.
JavaScript
6
star
27

cykelbanor

Bike routing for Sweden
JavaScript
5
star
28

gps-log-viewer

Web UI from gps-log
JavaScript
5
star
29

standstill

Find locations where there has been no movement, a stop, within a GeoJSON track, typically recorded from a GPS
JavaScript
5
star
30

fly-route

Fly over a map route using Mapbox GL (small demo)
JavaScript
4
star
31

course-sketcher

Web based course setting for orienteering
Vue
4
star
32

lrm-mapbox

DEPRECATED. Support for Mapbox directions API v4 in Leaflet Routing Machine
JavaScript
4
star
33

osm2obj

Generate Wavefront OBJ 3D models from OpenStreetMap XML or JSON
JavaScript
4
star
34

openlayers-tilejson

Create map or tile layer from TileJSON, with projection support
JavaScript
4
star
35

css-rankme-slack-bot

Slack bot to inform about important stats from Counter Strike Source's Rankme plugin
Python
3
star
36

lrm-svelte

Experiment making a Leaflet plugin using the Svelte framework
JavaScript
3
star
37

maptime-gbg-201602

"Let's learn Leaflet.js" presentation for Maptime GBG 2016-02
JavaScript
3
star
38

local-proj

Find a suitable local projection from GeoJSON data
JavaScript
3
star
39

brochure

Simple GeoJSON viewer based on Leaflet
JavaScript
3
star
40

jsprit.web

Server side of a simple Vechile Routing Problem solver built on jsprit
Java
2
star
41

mapbox-gl-routing-machine

A complete user interface for routing with Mapbox GL JS
JavaScript
2
star
42

roundabound

Simplistic log rotation utility
Python
2
star
43

ocad2tiles

Create raster images and tiles (image pyramids) from OCAD map files
JavaScript
2
star
44

advent-of-code

My solutions for Advent of Code
Python
2
star
45

svg-control-descriptions

IOF orienteering control descriptions as SVG
JavaScript
2
star
46

tradportalen-export

Export tree observations from Trädportalen
Shell
1
star
47

turfjs-gbgnodejs

Short introduction to turf.js @ gbgnodejs meetup
JavaScript
1
star
48

drone

Enjoy Mapbox's cloudless atlas
JavaScript
1
star
49

godwit

Minimalistic database migration tool
Python
1
star
50

vixel-test

Toying around with making voxel landscapes from height maps
JavaScript
1
star
51

memory-game

Very basic memory game I made for my kids
JavaScript
1
star
52

gps-track-import

Simple import of tracks for GPS
Python
1
star