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

Get Lat Long from map #91

Open
anim007 opened this issue Oct 11, 2017 · 2 comments
Open

Get Lat Long from map #91

anim007 opened this issue Oct 11, 2017 · 2 comments
Labels

Comments

@anim007
Copy link

anim007 commented Oct 11, 2017

Hii 2amigos, can i use this library for location picker? like get the lat long from marker i set. Thanks

@tonydspaniard
Copy link
Member

Hi @anim007 in order to place a marker, you need to know lat,lon. So I don't really understand your question but if you wish to get the location when the marker has been moved. Then I highly recommend that you append your custom JS to the widget so you can effectively get the current location of the marker.

@acidka
Copy link

acidka commented Jan 1, 2018

just add Event on "dragend" to the Marker

<?php

$marker_dragend_event_js = <<<JS
    document.getElementById('latitude_input').value = event.latLng.lat();
    document.getElementById('longitude_input').value = event.latLng.lng();
JS;

$marker = new Marker([
    'position'  => new LatLng(['lat' => 39.7200, 'lng' => 2.9116]),
    'draggable' => true,
    'title'     => 'Marker',
    'events'    => [
        new Event([
             'trigger' => 'dragend',
             'js'      => $marker_dragend_event_js,
        ]),
     ],
]);

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