Hello. Is it possible to somehow get coordinates into a form using Google Maps Api? For example, I have some frame with a map, I put a label there, and the coordinates of that label are transferred to my form?
There is a code from my old project. But here I enter point A and B, and a path is drawn between them, here I can pull out lng and lat. But can I find out the coordinates without entering a point, and just move the label on the map?
function GetMap($inCity, $outCity) { echo '<center> <iframe width="600" height="450" frameborder="0" style="border:0" src="https://www.google.com/maps/embed/v1/directions?origin='.$outCity.'&destination='.$inCity.'&key=ХХХ_CEjbAbKb0Lfqjlk" allowfullscreen></iframe> </center>'; } $request_params = array('origin' => $out ->street, 'destination'=> $in ->street, 'key'=>'ХХХ_HHpeZGjfgPpsFTBVPHXu4' ); $get_params = http_build_query($request_params); $str = json_decode(file_get_contents('https://maps.googleapis.com/maps/api/directions/json?'.$get_params)); foreach ($str->routes[0]->legs[0]->steps as $item) { $item->end_location->lng; // узнаем lng }