|
Luis Arturo López Vergara - 2016-11-14 20:06:31
Hi, I see that it´s a great PHP Class. But also I have the same problem in a localhost enviroment, I try used:
try {
$pos = $map->getLatLng('Eiffel Tower, Paris', MapBuilder::URL_FETCH_METHOD_CURL);
} catch (MapBuilderException $ex) {
//die($ex->getMessage());
}
But I get
Notice: Undefined variable: pos in
Please help me, don´t undestand this error
Thanks, for your support.
Vagharshak Tozalakyan - 2016-11-14 20:19:50 - In reply to message 1 from Luis Arturo López Vergara
Hi, I need to see the complete code in order to be able to help you.
Luis Arturo López Vergara - 2016-11-14 20:31:24 - In reply to message 2 from Vagharshak Tozalakyan
the code for ex2:
<?php
// Include MapBuilder class.
require_once 'class.MapBuilder.php';
// Create MapBuilder object.
$map = new MapBuilder();
// Establecer la ApiKey
$map->setApiKey("AIzaSyBLAUmCOTU7XLOJEhPqXlT4zwUOs_43QWo");
// Retrieve coordinates of address.
try {
$pos = $map->getLatLng('Eiffel Tower, Paris', MapBuilder::URL_FETCH_METHOD_CURL);
} catch (MapBuilderException $ex) {
// die($ex->getMessage());
}
// Set map's center position by latitude and longitude coordinates.
$map->setCenter($pos['lat'], $pos['lng']);
// Add a marker with specified color and symbol.
$map->addMarker($pos['lat'], $pos['lng'], array(
'title' => 'Eiffel Tower',
'defColor' => '#FA6D6D',
'defSymbol' => 'E'
));
// Set the default map type.
$map->setMapTypeId(MapBuilder::MAP_TYPE_ID_ROADMAP);
// Set width and height of the map.
$map->setSize(650, 450);
// Set default zoom level.
$map->setZoom(17);
// Set minimum and maximum zoom levels.
$map->setMinZoom(10);
$map->setMaxZoom(19);
// Disable mouse scroll wheel.
$map->setScrollwheel(false);
// Make the map draggable.
$map->setDraggable(true);
// Enable zooming by double click.
$map->setDisableDoubleClickZoom(false);
// Disable all on-map controls.
$map->setDisableDefaultUI(true);
// Display the map.
$map->show();
?>
Of course add the API KEY, if I don´t comment this line
// die($ex->getMessage());
only get The message:
Unable to get coordinates. JSON parser error.
thanks for your support
Luis Arturo López Vergara - 2016-11-15 20:36:33 - In reply to message 2 from Vagharshak Tozalakyan
HI did you see the code. Please I´m newbie. Please help me
Vagharshak Tozalakyan - 2016-11-23 12:37:52 - In reply to message 4 from Luis Arturo López Vergara
Sorry for the late response. Please download and try the latest version of library.
Luis Arturo López Vergara - 2016-11-26 21:00:12 - In reply to message 5 from Vagharshak Tozalakyan
Thanks Vagharshak Tozalakyan.
All great.
|