arcasolutions/google-map
Laravel package providing Google Maps integration for your app, with helpers to generate map views and include the required scripts. Useful for quickly embedding maps and configuring markers or map options within Laravel projects.
Markers identify locations on the map. By default, they use a standard icon.
use Ivory\GoogleMap\Overlays\Animation;
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Configure your marker options
$marker->setPrefixJavascriptVariable('marker_');
$marker->setPosition(0, 0, true);
$marker->setAnimation(Animation::DROP);
$marker->setOption('clickable', false);
$marker->setOption('flat', true);
$marker->setOptions(array(
'clickable' => false,
'flat' => true,
));
For configurating the marker animation, the better way is to follow the oriented object way. For that, the
Ivory\GoogleMap\Overlays\Animation is here. It allows you to access all constants which describe marker animation.
If you don't want to use this class, you can directly use the constant value.
use Ivory\GoogleMap\Overlays\Animation;
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Sets your marker animation
$marker->setAnimation(Animation::BOUNCE);
$marker->setAnimation('bounce');
$marker->setAnimation(Animation::DROP);
$marker->setAnimation('drop');
By default, the marker uses a standard icon. If you want to change this icon, two ways are available. You can use an icon url or a marker image. The first solution is appropriated if you build an icon which doesn't need any specific configuration (anchor, origin, size or scaled size). If you want to build an advanced icon, you must use the marker image.
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Sets the icon URL
$marker->setIcon('http://maps.gstatic.com/mapfiles/markers/marker.png');
The complete marker image configuration is available here.
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Sets the marker image
$marker->setIcon($markerImage);
Like marker icon, the marker uses a standard shadow but if you want to change this shadow, two ways are available. You can use a shadow url or a marker image. The first solution is appropriated if you build a shadow which doesn't need any specific configuration (anchor, origin, size or scaled size). If you want to build an advanced shadow, you must use the marker image.
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Sets the shadow URL
$marker->setShadow('http://maps.gstatic.com/mapfiles/markers/marker.png');
The complete marker image configuration is available here.
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Sets the marker image
$marker->setShadow($markerImage);
The complete marker shape configuration is available here.
Now you have configurated your marker, you need to add it to the map.
use Ivory\GoogleMap\Overlays\Marker;
$marker = new Marker();
// Add your marker to the map
$map->addMarker($marker);
How can I help you explore Laravel packages today?