I'm trying to create a website for a fast food company with more than 50 branches. I want to use Leaflet.js as map and geocoder for getting location from address. On every branch page, I need to find the location from address and mark it on the map.
I've checked leaflet and geocoder but could not find how to pass a default address value to map instead of using search function. All examples show search and get the location but I want to find location from address(text) and pass this location to setView. Is there a function to use it for this purpose? (Note: I don't use any Js framework)
<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>
var map = L.map('map').setView([0, 0], 5);
var geocoder = L.Control.Geocoder.nominatim();
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 8,
attribution: '© OpenStreetMap'
}).addTo(map);
var address = 'ASD AASD ASD' // I don't know where to use address