Open neoacevedo opened 6 years ago
There is a plugin for leaflet: https://github.com/domoritz/leaflet-locatecontrol
But, how to ask for it from here?:
$leaflet = new \dosamigos\leaflet\LeafLet([
'center' => $center, // set the center
]);
@neoacevedo I would simply use any IP to LatLng service (for example: https://iplocation.com/) . It also depends on what you want to accomplish on your project. The mentioned plugin by @cebe also works if you wish to provide the solution on the frontend using scripts.
@tonydspaniard I have used that plugin in standalone LeafLet maps where I can get the current location on page load, but my question is focused to the PHP environment, but I think I'm misunderstanding something in the process that I will check and post here later. Anyway I think, as suggestion, this should allow instantiate LeafLet without any parameter, an equivalent in JS:
var map = L.map('myDiv');
I'ts a simple question: how do I to ask to user for its current location?