smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.03k stars 273 forks source link

[Question] How to install and use? #201

Closed Steelhand closed 4 years ago

Steelhand commented 4 years ago

How do you install this thing for a total newbie?

I managed to install node.js and npm, and do npm install --save leaflet.geosearch (with a few errors)

But what now? How can I use it? What language is this? Typing this directly into the html code surely didn't work. import { OpenStreetMapProvider } from 'leaflet-geosearch';

I was expecting something along the lines of:

Maybe this script is beyond my capacity?

pierreloicq commented 4 years ago

See https://github.com/smeijer/leaflet-geosearch/issues/92

pierreloicq commented 4 years ago

There's something I don't understand: if npm is the "node package manager", and node was made to run js on server-side, it does not mean that code installed with npm is run exclusively on the server side ? Thanks

smeijer commented 4 years ago

Closing, as docs have been improved. I hope that answers most questions. If not, please let me know.

https://smeijer.github.io/leaflet-geosearch/

@pierreloicq , yes, npm is short for node package manager, but pretty much all javascript libraries, regardless of front or backend are hosted there.

Bower deprecated itself in favor of npm, and I don't know of any other serious alternatives either.

npm itself, is indeed not a browser tool. It runs on your system, and you'll probably want to combine it locally with a bundler. The result of bundling is just javascript though. So unless you're using specific non-browser api's (such as filesystem calls), it will run perfectly fine in the browser.

Anyway, if you don't want to use npm, it's still possible to load it from a can (unpkg.com)