Closed vozer closed 4 years ago
Hi, you can achieve this usng the raw data return format. The PHP-Code printing the link should look like this somehow:
$value = get_field('map_field_key');
if ( count( $value['markers'] ) ) {
printf('<a href="https://www.openstreetmap.org/#%d/%f/%f">%s</a>',
$value['zoom'],
$value['markers'][0]['lat'],
$value['markers'][0]['lng'],
esc_html( $value['markers'][0]['label'] )
);
}
// Responsible pasting: Please comprehend before you paste!
Thx a lot! Works like a charm! i just changed the link to also show the marker:
<?php $value = get_field('ubicacion_real'); if ( count( $value['markers'] ) ) { printf('<a href="https://www.openstreetmap.org/?mlat=%f&mlon=%f#map=%d/">%s</a>', $value['markers'][0]['lat'], $value['markers'][0]['lng'], $value['zoom'], esc_html( $value['markers'][0]['label'] ) ); } ?>
Thanks for the addon so far!
I am wondering if there is a Possibility to also generate the html output instead of a map as a Link to Open-Street-Maps like:
<a href"link to open street map">British Museum, Russell Street, London
or the have both at the same time?