Skip to content
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.

Ask for current location #42

Open
neoacevedo opened this issue Aug 24, 2018 · 4 comments
Open

Ask for current location #42

neoacevedo opened this issue Aug 24, 2018 · 4 comments
Labels

Comments

@neoacevedo
Copy link

I'ts a simple question: how do I to ask to user for its current location?

@cebe
Copy link

cebe commented Sep 14, 2018

There is a plugin for leaflet: https://github.com/domoritz/leaflet-locatecontrol

@neoacevedo
Copy link
Author

But, how to ask for it from here?:

$leaflet = new \dosamigos\leaflet\LeafLet([
    'center' => $center, // set the center
]);

@tonydspaniard
Copy link
Member

@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.

@neoacevedo
Copy link
Author

@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'); 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants