Giter VIP home page Giter VIP logo

googlmapper's Introduction

An easy way to integrate Google Maps with Laravel

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality

For Laravel 5.x, check version 2.35.1

For Laravel 4.x, check version 1.27.0

Think of Googlmapper as an easy way to integrate Google Maps with Laravel, providing a variety of helpers to speed up the utilisation of mapping. These include:

  • Mapper::map
  • Mapper::location
  • Mapper::streetview
  • Mapper::marker
  • Mapper::informationWindow
  • Mapper::polyline
  • Mapper::polygon
  • Mapper::rectangle
  • Mapper::circle
  • Mapper::render

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require cornford/googlmapper.

"require": {
	"cornford/googlmapper": "3.*"
}

Next, update Composer from the Terminal:

composer update

Once this operation completes, the next step is to add the service provider. Open app/config/app.php, and add a new item to the providers array.

Cornford\Googlmapper\MapperServiceProvider::class,

The next step is to introduce the facade. Open app/config/app.php, and add a new item to the aliases array.

'Mapper'         => Cornford\Googlmapper\Facades\MapperFacade::class,

Finally we need to introduce the configuration files into your application.

php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider" --tag=googlmapper

You also need to set your Google API Key into the GOOGLE_API_KEY environment variable. To obtain an API key for your project, visit the Google developers console.

That's it! You're all set to go.

Configuration

You can now configure Googlmapper in a few simple steps. Open app/config/packages/cornford/googlmapper/config.php and update the options as needed.

  • enabled - Enable Google Maps.
  • key - A Google Maps API key.
  • region - A region Google Maps should utilise, required in ISO 3166-1 code format, e.g. GB.
  • language - A language Google Maps should utilise, required in ISO 639-1 code format, e.g. en-gb.
  • async - Perform the loading and rendering of Googlmapper map asynchronously, e.g. false.
  • marker - Automatically add Google Maps marker for your maps initial location, e.g. true.
  • center - Automatically center Google Maps around the initial location, when false, Google Maps will automatically center the map, e.g. true.
  • locate - Automatically center Google Maps around the users current location, when false, Google Maps will automatically center the map, e.g. true.
  • zoom - Set the default zoom level for Google Maps, e.g. 8.
  • scrollWheelZoom - Set the default scroll wheel zoom Google Maps, e.g. true.
  • zoomControl - Set the default zoom control for Google Maps, e.g. true.
  • mapTypeControl - Set the default map type control for Google Maps, e.g. true.
  • scaleControl - Set the default scale control for Google Maps, e.g. true.
  • streetViewControl - Set the default street view control for Google Maps, e.g. true.
  • rotateControl - Set the default rotate control for Google Maps, e.g. true.
  • fullscreenControl - Set the default fullscreen control for Google Maps, e.g. true.
  • gestureHandling - Set the default gesture handling for Google Maps, e.g. auto, none, cooperative, greedy.
  • type - Set the default map type for Google Maps, e.g. ROADMAP, SATELLITE, HYBRID, TERRAIN.
  • ui - Show the Google Maps default UI options, e.g. true.
  • markers.icon - Set the default marker icon, e.g. img/icon.png.
  • markers.animation - Set the default marker animation, e.g. NONE, DROP, BOUNCE.
  • markers.autoClose - Automatically close Information Windows of current marker when other markers are clicked, e.g. true.
  • cluster - Set if map marker clusters should be used.
  • clusters.icon - Display custom images for clusters using icon path.
  • clusters.grid - The grid size of a cluster in pixels.
  • clusters.zoom - The maximum zoom level that a marker can be part of a cluster.
  • clusters.center - Whether the center of each cluster should be the average of all markers in the cluster.
  • clusters.size - The minimum number of markers to be in a cluster before the markers are hidden and a count is shown.

Usage

It's really as simple as using the Mapper class in any Controller / Model / File you see fit with:

Mapper::

This will give you access to

Example

Initialize the map in your controller MapController.php:

use Mapper;

public function index()
{
	Mapper::map(53.381128999999990000, -1.470085000000040000);

	return view('map')
}

Within in the view map.blade.php add following code to render the map:

<div style="width: 500px; height: 500px;">
	{!! Mapper::render() !!}
</div>

Map

The map method allows a map to be created, with latitude, longitude and optional parameters for options.

Mapper::map(53.381128999999990000, -1.470085000000040000);
Mapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' => 15, 'center' => false, 'marker' => false, 'type' => 'HYBRID', 'overlay' => 'TRAFFIC']);
Mapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' => 10, 'markers' => ['title' => 'My Location', 'animation' => 'DROP']]);
Mapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' => 10, 'markers' => ['title' => 'My Location', 'animation' => 'DROP'], 'cluster' => false]);
Mapper::map(53.381128999999990000, -1.470085000000040000, ['zoom' => 10, 'markers' => ['title' => 'My Location', 'animation' => 'DROP'], 'clusters' => ['size' => 10, 'center' => true, 'zoom' => 20]]);
Map Events

Before Load

This event is fired before the map is loaded.

Mapper::map(53.381128999999990000, -1.470085000000040000, ['eventBeforeLoad' => 'console.log("before load");']);

After Load

This event is fired after the map is loaded.

Mapper::map(53.381128999999990000, -1.470085000000040000, ['eventAfterLoad' => 'console.log("after load");']);

Location

The location method allows a location to be searched for with a string, returning a Location object with its latitude and longitude.

Mapper::location('Sheffield');
Mapper::location('Sheffield')->map(['zoom' => 15, 'center' => false, 'marker' => false, 'type' => 'HYBRID', 'overlay' => 'TRAFFIC']);
Mapper::location('Sheffield')->streetview(1, 1, ['ui' => false]);

Streetview

The streetview method allows a streetview map to be created, with latitude, longitude, heading, pitch and optional parameters for options.

Mapper::streetview(53.381128999999990000, -1.470085000000040000, 1, 1);
Mapper::streetview(53.381128999999990000, -1.470085000000040000, 1, 1, ['ui' => false]);

Marker

The marker method allows a marker to be added to a map, with latitude, longitude, and optional parameters for options.

Mapper::marker(53.381128999999990000, -1.470085000000040000);
Mapper::marker(53.381128999999990000, -1.470085000000040000, ['animation' => 'DROP', 'label' => 'Marker', 'title' => 'Marker', 'draggable' => true]);
Mapper::marker(53.381128999999990000, -1.470085000000040000, ['icon' => 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=|FE6256|000000']);
Mapper::marker(53.381128999999990000, -1.470085000000040000, ['icon' => ['url' => 'https://chart.googleapis.com/chart?chst=d_map_pin_letter&chld=|FE6256|000000', 'scale' => 100]]);
Mapper::map(52.381128999999990000, 0.470085000000040000, ['markers' => ['icon' => ['symbol' => 'CIRCLE', 'scale' => 10], 'animation' => 'DROP', 'label' => 'Marker', 'title' => 'Marker']])->marker(53.381128999999990000, -1.470085000000040000);
Mapper::marker(53.381128999999990000, -1.470085000000040000, [
	'title' 	=> 'title',
	'icon'      => [
		'path'         => 'M10.5,0C4.7,0,0,4.7,0,10.5c0,10.2,9.8,19,10.2,19.4c0.1,0.1,0.2,0.1,0.3,0.1s0.2,0,0.3-0.1C11.2,29.5,21,20.7,21,10.5 C21,4.7,16.3,0,10.5,0z M10.5,5c3,0,5.5,2.5,5.5,5.5S13.5,16,10.5,16S5,13.5,5,10.5S7.5,5,10.5,5z',
		'fillColor'    => '#DD716C',
		'fillOpacity'  => 1,
		'strokeWeight' => 0,
		'anchor'       => [0, 0],
		'origin'       => [0, 0],
		'size'         => [21, 30]
	],
	'label'     => [
		'text' => 'Marker',
		'color' => '#B9B9B9',
		'fontFamily' => 'Arial',
		'fontSize' => '13px',
		'fontWeight' => 'bold',
	],
	'autoClose' => true,
	'clickable' => false,
	'cursor' => 'default',
	'opacity' => 0.5,
	'visible' => true,
	'zIndex' => 1000,
]);

Draggable Markers

If you need draggable marker, you can add option draggable.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true]);
Draggable Events

Click

This event is fired when the marker icon was clicked.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventClick' => 'console.log("left click");']);

Double Click

This event is fired when the marker icon was double clicked.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventDblClick' => 'console.log("double left click");']);

Right Click

This event is fired for a right click on the marker.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventRightClick' => 'console.log("right click");']);

Mouse Over

This event is fired when the mouse enters the area of the marker icon.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventMouseOver' => 'console.log("mouse over");']);

Mouse Down

This event is fired for a mouse down on the marker.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventMouseDown' => 'console.log("mouse down");']);

Mouse Up

This event is fired for a mouse up on the marker.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventMouseUp' => 'console.log("mouse up");']);

Mouse Out

This event is fired when the mouse leaves the area of the marker icon.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventMouseOut' => 'console.log("mouse out");']);

Drag

This event is repeatedly fired while the user drags the marker.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventDrag' => 'console.log("dragging");']);

Drag Start

This event is fired when the user starts dragging the marker.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventDragStart' => 'console.log("drag start");']);

Drag End

This event is fired when the user stops dragging the marker.

Mapper::marker(53.381128999999990000, -1.470085000000040000, ['draggable' => true, 'eventDragEnd' => 'console.log("drag end");']);

Information Window

The informationWindow method allows an information window to be added to to a map, with latitude, longitude, content, and optional parameters for options.

Mapper::informationWindow(53.381128999999990000, -1.470085000000040000, 'Content');
Mapper::informationWindow(53.381128999999990000, -1.470085000000040000, 'Content', ['open' => true, 'maxWidth'=> 300, 'autoClose' => true, 'markers' => ['title' => 'Title']]);
Mapper::map(52.381128999999990000, 0.470085000000040000)->informationWindow(53.381128999999990000, -1.470085000000040000, 'Content', ['markers' => ['animation' => 'DROP']]);

Polyline

The polyline method allows a polyline to be added to a map, with coordinates, and optional parameters for options.

Mapper::polyline([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]]);
Mapper::polyline([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]], ['editable' => 'true']);
Mapper::map(52.381128999999990000, 0.470085000000040000)->polyline([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]], ['strokeColor' => '#000000', 'strokeOpacity' => 0.1, 'strokeWeight' => 2]);

Polygon

The polygon method allows a polygon to be added to a map, with coordinates, and optional parameters for options.

Mapper::polygon([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]]);
Mapper::polygon([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]], ['editable' => 'true']);
Mapper::map(52.381128999999990000, 0.470085000000040000)->polygon([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]], ['strokeColor' => '#000000', 'strokeOpacity' => 0.1, 'strokeWeight' => 2, 'fillColor' => '#FFFFFF']);

Rectangle

The rectangle method allows a rectangle to be added to a map, with coordinates, and optional parameters for options.

Mapper::rectangle([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]]);
Mapper::rectangle([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]], ['editable' => 'true']);
Mapper::map(52.381128999999990000, 0.470085000000040000)->rectangle([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000], ['latitude' => 52.381128999999990000, 'longitude' => 0.470085000000040000]], ['strokeColor' => '#000000', 'strokeOpacity' => 0.1, 'strokeWeight' => 2, 'fillColor' => '#FFFFFF']);

Circle

The circle method allows a circle to be added to a map, with coordinates, and optional parameters for options.

Mapper::circle([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000]]);
Mapper::circle([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000]], ['editable' => 'true']);
Mapper::map(52.381128999999990000, 0.470085000000040000)->circle([['latitude' => 53.381128999999990000, 'longitude' => -1.470085000000040000]], ['strokeColor' => '#000000', 'strokeOpacity' => 0.1, 'strokeWeight' => 2, 'fillColor' => '#FFFFFF', 'radius' => 1000]);

Render

The render method allows all maps to be rendered to the page, this method can be included in Views or added as controller passed parameter, and optional parameter for item.

Mapper::render();
Mapper::render(0);

RenderJavascript

The renderJavascript method allows all required javascript to be rendered to the page, this method can be included in Views or added as controller passed parameter.

Mapper::renderJavascript();

License

Googlmapper is open-sourced software licensed under the MIT license

googlmapper's People

Contributors

atefbb avatar azorpax avatar bradcornford avatar dbr0 avatar jochensengier avatar jozeflambrecht avatar kylops avatar leewillis77 avatar michellaurent avatar sdekkers avatar syahzul avatar tailonperin avatar td204 avatar vjoao avatar vool avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

googlmapper's Issues

Error during installtion

Hi,

I found this issue in windows command line
PHP Fatal error: Call to undefined method Cornford\Googlmapper\MapperServicePro
vider::mergeConfigFrom() in E:\xampp\htdocs\pagers-api\vendor\cornford\googlmapp
er\src\Cornford\Googlmapper\MapperServiceProvider.php on line 41
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","me
ssage":"Call to undefined method Cornford\Googlmapper\MapperServiceProvider::m
ergeConfigFrom()","file":"E:\xampp\htdocs\pagers-api\vendor\cornford\googl
mapper\src\Cornford\Googlmapper\MapperServiceProvider.php","line":41}}
E:\xampp\htdocs\pagers-api>

when I execute this command:
php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider"

thank you

Polygon data out of the database

I am trying to make a polygon from the database.
I the DB i have a columb called polygon with (for example)

    ['longitude' => 1, 'latitude' => 6 ],['longitude' => 2, 'latitude' => 6 ]

in the controller:

    $points = DB::table('polygons_data')->select('polygon')->get();
    $map = Mapper::map(5, -2);
    $map->polygon([$points[0]->polygon]);        
    return view('test');

but when I am trying this in the output I am having something like
$map->polygon(['['longitude' => 1, 'latitude' => 6 ],['longitude' => 2, 'latitude' => 6 ]']);

So the problem is these ' ' but they are comming automaticly,
Any ideas how to make it working

Render is not showing map

Hi,

I just looked for your issues here and was trying to show google maps in my page.
I just add this code to my blade file:

@section('content')
<div class="container">
    <div class="row">
        <div class="mymap">
            {!! Mapper::render() !!}
        </div>
    </div>
</div>
@endsection

but nothing is showing...
Then, I looked for the source of the page and I'm getting this:

 <div class="row">
        <div class="mymap">
            <script type="text/javascript" src="//maps.googleapis.com/maps/api/js?v=3.exp&region=BR&language=pt-br&key=removed_by_me&signed_in=false&libraries=places"></script>


    <script type="text/javascript" src="//googlemaps.github.io/js-marker-clusterer/src/markerclusterer.js"></script>
        </div>

As you can see, the javascript part, that is explained in the official google maps helper, it was not included:

    <div id="map"></div>
    <script>
      var map;
      function initMap() {
        map = new google.maps.Map(document.getElementById('map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 8
        });
      }
    </script>

Am I missing something here? The only file that I changed was the blade file. And this is laravel's 5.2 out of the box new project.

Cheers,
Joao

Number of Markers when zoom out

Hello,

When zoom out on map markers seem with number. Like this:
mapimage

U can see that it is really hard to find this small number in the map. How can we change image type of this numbers?

Also i found this kind of example.
map2

can we change icons like example?

Thanks,

Hakan

Laravel 5.2 support

Hey Bradley,

I'm not too sure this package supports laravel 5.2 (or 5+). Just wondering if it's possible to use in L5. I really dig the functionality. Would be great to use

Non-static method Cornford\Googlmapper\Mapper::map() should not be called statically, assuming $this from incompatible context

I am using Laravel 5.1 and I have eddited the composer.json and updated it. Then eddited app.php with
Cornford\Googlmapper\MapperServiceProvider::class, and
'Mapper' => Cornford\Googlmapper\Facades\MapperFacade::class, .
Then runned
php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider"
and e had 'Nothing to publish for tag []'
in routes.php
Route::get('/map', 'Test@map' );
in the model Test.php
Mapper::map(53.381128999999990000, -1.470085000000040000);

And I have this error:

Non-static method Cornford\Googlmapper\Mapper::map() should not be called statically, assuming $this from incompatible context

Any suggestion will be nice. Thank you

Map Click method?

Hi,

I would like to let the user mark a point in the map. In my particular case, to register a place.

I did notice that we do have the dragable marker, but I would like to also let user click in the map and make the marker move to the place where the map was clicked.

Is this possible? How can I do it?

Thanks,
Joao

Resize map to fit markers

Thanks for the great work on Googlmapper. How would I tell Mapper to set the zoom and boundaries of the map so that it shows all of the markers? I usually do this by calling something like "resize", but I can't figure out the call with Mapper. Or maybe there's a setting when you create the map in the controller?

Thanks.

Facade Call

I am trying to call Mapper facade from my controller, but I am receiving the following error message:

Non-static method Cornford\Googlmapper\Mapper::map() should not be called statically, assuming $this from incompatible context

I added Mapper::render() on my view, but I am receiving lines of HTML code instead.
What am I doing wrong?

How do I create multiple map and render it at two places in view

I need to display multiple maps in same page or atleast with a click of button change the markers. I am not able to figure out how can I send multiple map data from controller and render it in view.

Please guide. Also make you documentation more proper and give examples for all the available options as on searching I can find there had been one commit for multiple maps but there is nothing in documentation which can guide how to implement multiple maps.

View [mapper] not found.

Hi mate,
What have you changed after v2.3.0 till v2.7.0 cus I have not changed any of the code and now I have
View [mapper] not found. (View: C:\xampp\htdocs\resources\views\vendor\country.blade.php)
When I try the backup before the update everything is fine but..

no directory found

In my laravel project 5.2.39 I am not finding app/config/app.php. What should I do ? Please help me !
Thanks....

Rendering problem

Hi,

I checked the issue 18 but nothing to do nothing is rendered and no error message. I am just testing it on my web app in the user controller and show view. Can you spot the problem?

displaying the mapper

hello,

i am using Laravel 5.2 for viewing google maps along with different markers. but i couldn't manage to use it (view the map)

i think i have understood how this api works but i couldn't manage to see the map (render the map) but i do see the values i have retrieved using the var_dump() method.

could you please show me how i use it in my view page (php with blade).

it is not working but this is how i thought it would work:
****** in my controller class ********
$mapper = \Mapper::map($workGPSLocations[0], $workGPSLocations[1]);

return view('home')->with('mapper', $mapper);

***** view ****

<ifram width="100%" height="600" frameborder="0" style="border:0"
                            src="{!! $mapper->render(0) !!}"></ifram>

and

<ifrme width="100%" height="600" frameborder="0" style="border:0">
{!! $mapper->render(0) !!}</ifrme>

and

{!! $mapper->render(0) !!}

.
.
..

Nothing is working for me. could you please give a sample code.

Thank you!!!

Map Boundaries

Hi again,

My other issue is that I will show a lot of markers and this could cause a the connection with the server to be too slow...
What I did in android was to get the boundaries of the map that is showing to the user and only get the points that should be showed.

Is there any way to get the boundaries? Or should I use the clustered markers in instead?

Thanks,
Joao

publishable views

Hello, can you make views publishable ? For example i need add some options , but i can't...

Nothing to publish for tag

I tried to publish in laravel 5 but I getting this error.

c:\xampp\htdocs\laravel>php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider"
Nothing to publish for tag [].

Cornford\Googlmapper\Mapper::map() should not be called statically

I use laravel 5.1 and when need to use Googlmapper i see this an error
Non-static method Cornford\Googlmapper\Mapper::map() should not be called statically, assuming $this from incompatible context

Note:i did some of changes in my app.php file to be comptable with laravel 5.1
Instead of 'Cornford\Googlmapper\MapperServiceProvider' Cornford\Googlmapper\MapperServiceProvider::class

And the Same thing in Facade aliases Any Suggestions

Thanks for your time and thanks for this awesome API

Views

Hello! How i can choose dir for load my views? 👍

InvalidArgumentException in FileViewFinder.php line 140: View [mapper] not found.

Hi, I've just updated my Laravel 5.0 app with composer in my vagrant box and the Googlmapper plugin does not work anymore.
The error is
InvalidArgumentException in FileViewFinder.php line 140:
View [mapper] not found.

in FileViewFinder.php line 140
at FileViewFinder->findInPaths('mapper', array('/home/vagrant/Code/XXXX/resources/views/cornford/googlmapper')) in FileViewFinder.php line 90
at FileViewFinder->findNamedPathView('googlmapper::mapper') in FileViewFinder.php line 74
at FileViewFinder->find('googlmapper::mapper') in Factory.php line 145
at Factory->make('googlmapper::mapper') in Mapper.php line 27
at Mapper->render() in Facade.php line 207

Just did:

#php artisan cache:clear
# php artisan route:clear
# php artisan config:cache
# php artisan config:clear
# composer update

with no luck...
How can solve it?

Directions

Hi @bradcornford your project is very nice, I was looking for something like that, but, how to use directions? is there a way to implement this? and further I'm looking for a way to update latlon on the fly using Angular or Vue Js.
Do you have any tip for that?
Thank you.

Data passed to views is not escaped

Tried setting a marker title with an apostrophe in it, and it broke badly:

Mapper:map($lat, $lon, ["markers"=>["title"=>"John's Place", "animation"=>"DROP"], "zoom"=>14]);

I was looking at how best to solve the problem, it seems like building the options as a PHP object inside the Marker::render() method would work well, and allow you to remove a lot of if/else logic from the view. You could simply encode it as JSON and pass the whole thing directly to the JavaScript constructor.

While investigating this, I also noticed there's a function close on line 58 of marker.blade.php that's inside an @if block. I don't think it's getting inserted if the @if isn't true.

Call to undefined method MapperServiceP rovider::mergeConfigFrom() during publish

Hi,

Would like to try it out but I'm getting this error:

Laravel 4.1.2
Wamp Server 2.5
Windows 8 (64 Bit)

Error:
C:\wamp\www\ninestars>php artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider"
{"error":{"type":"Symfony\Component\Debug\Exception\FatalErrorException","message":"Call to undefined method Cornford\Googlmapper\MapperServiceP
rovider::mergeConfigFrom()","file":"C:\wamp\www\ninestars\vendor\cornford\googlmapper\src\Cornford\Googlmapper\MapperServiceProvider.php","l
ine":41}}

Thanks.

Issue on displaying the map using 'location'

Hi Bradcornford,
Thanks for the library, however I am unable to load the map when I try below code; any help to make the below code work would be really helpful.

Mapper::location('Sheffield');
echo Mapper::render();

Please add mouse behavior support

Hi there, thanks for your good work, I love it!

Please think about adding mousewheel support to Googlmapper. I am using Googlmapper at full width in my webpages and everytime I am scrolling my page with my mousewheel and as soon as the mouse pointer is over the map scrolling stops and instead the map is zooming in or out. I am sure a lot of people experience this behavior. It is not logical.

auto-center map with multiple markers

How can I auto-center the map when I have multiple markers?
e.g.

Mapper::map(null, null);
        $collection = Trip::all();


        $collection->each(function($trip)
        {
            $content = $trip->name;

            Mapper::informationWindow($trip->lat, $trip->lng, $content);
        });

Based on the lat-lng values of the trips, I want the map be centered around these information windows...

Problem with informationWindow

Hello

I´m using yourt great library but I´ve a problem with informationWindow.
All is integrated and the map is drawed with markers and without javascript errors.
But when i try include an informationWindow, this does not appears.
If I use a simple example like:

Mapper::map(52.381128999999990000, 0.470085000000040000)->informationWindow(53.381128999999990000, -1.470085000000040000, 'Content', ['markers' => ['animation' => 'DROP']]);

and make a render in view, the marker appear, the maps renders ok but when click over marker I can´t see the informationWindow.

Do you know where could be the problem?

Thanks!

Is there a way to disable Scroll Wheel ?

Is there a way to disable scroll wheel? It is possible with standard JavaScript Maps API, however I am having trouble finding it here ?

Forgot to mention I am forced to edit your source but is it something you are looking to add in or is it already in somewhere ?

Accessing map variable in JavaScript

Hi,

Awesome project, very helpful. Thanks!

I'm writing to ask how I can access the "map" variable via JavaScript. I need to update the map with new coordinate (following a search via the JS API) but I'm doing something wrong. I'm wondering if you can provide a pointer on how to do this, on how to hook into your JS code.

Specifically, I'd like to trigger a new search (against a postcode, for example) and update the map to drop the pin in the new location).

I know this isn't the best place to ask but perhaps others will find it useful.

Thanks again for the great library.

PS: in a worst-case scenario I know I can always to an AJAX call and replace the map element with the response but that seems kludgy.

Setting marker color and other marker attributes

Hi again,

Really, really loving this module, btw…

I'm trying to set the color of markers. I've reviewed the Google Docs on the subject but I can't quite see where or how to modify the color (and other attributes) of markers.

Given:
Mapper::informationWindow($lat, $lng, 'content')

It looks like I could do something like:
Mapper::informationWindow($lat, $lng, 'content', ['markers' => ['symbol' => 'circle', 'fillColor' => 'red']])

But I'm missing something. Any help would be greatly appreciated.

Thanks and if it means extending one of your classes, I'll gladly contribute whatever I produce.

Ted

view problem

hi brad,

I use {{ $map }} in my blade view but it failed to show a map, instead a bunch of code shows as text. what is a proper way to show your map in view?

thank you!

Recent issues - markers and clustering

Hey, I've been having issues recently with this Mapper pacakage.

Firstly, clustering stopped working with my initial implementation, although it had worked fine for weeks until I ran a composer update.

Having updated (cannot remember last version but only 2 months ago) I was gettings errors so tried your examples with info windows and markers. I seem to always get the following JS error no matter what!

ReferenceError: markers_ is not defined
if (markers_.length < this.minClusterSize_) {

Any ideas?

Great package by the way, I was initally up and running in 30 minutes.

Add option to access map in Javascript

Is there a way to add an extra option to Googlmapper like "$enableGlobalAccess" that allows developers to access the created map through Javascript after rendering?

The only thing this would have to do is create the var map outside of the initialize() function and now use the "var" map keyword inside of the function. That way, developers can manipulate the map after rendering by using javascript.

Cluster icon

Hi

how to set an icon to a cluster of markers ?

Auto Suggest and Display Particular property

Hay there..
Without doubt, its a nice work. However, I am planning to get location autosuggest option. Is there any way to do so?

Again, if I need to collect any particular property from Mapper::location, how can I do so?
For example, when I render location I get following result -
Location {#276 ▼ #search: "Kuala Lumpur, Malaysia " #address: "Kuala Lumpur, Federal Territory of Kuala Lumpur, Malaysia" #type: "locality" #latitude: 3.139003 #longitude: 101.686855 #placeId: "ChIJ5-rvAcdJzDERfSgcL1uO2fQ" }

From there, I just wanna get latitude and longitude result. How can I get it?

Laravel 4 install not working

I added the lines to my composer.json and app.php, but when I send the command 'php artisan config:publish cornford/googlemapper' I receive an error:

[InvalidArgumentException]
Configuration not found.
config:publish [--path[="..."]] [--force] package

It still created the folder in my vendor folder, but not my config/packages folder when I updated composer.

I received the error message: 'Class 'Cornford\Googlmapper\Facades\Mapper' not found' when trying to use it anyway.

Not working for Laravel 5

It looks like the package doesn't work with Laravel 5.
I think that you have to update your service provider to be compliant with the last versions of Laravel.

 [BadMethodCallException]            
  Call to undefined method [package]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.