bradcornford / googlmapper Goto Github PK
View Code? Open in Web Editor NEWAn easy way to integrate Google Maps with Laravel
License: MIT License
An easy way to integrate Google Maps with Laravel
License: MIT License
How to disable all point-of-interests information in mapper?
Hi,
Could you please integrate the marker clusters for this version?
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®ion=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
Getting this javascript error in the console when running:
<?php $content = $marker['count'].' '.str_replace("'", "\\'", $marker['city']).' Customers<br />'; ?> <?php $map->informationWindow($marker['latitude'], $marker['longitude'], $content, ['markers' => ['title'=>'Title','symbol' => 'circle', 'scale' => 1000]]); ?>
How do i get it to render into a div?
In my laravel project 5.2.39 I am not finding app/config/app.php. What should I do ? Please help me !
Thanks....
It would be nice to have the ability to use marker clusterer when having many markers.
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.
Is there any chanse that you can add MarkerClusterer. Or any information where do I need to impliment them. Thanks mate.
https://developers.google.com/maps/articles/toomanymarkers
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.
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
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.
Hello, Do you have any plans to deploy clustered markers ??
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
Is there a way to center a map using an address or a zip code ?
hi, how can i get the new radius and center of circle when radius or center changed
thanks
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!
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
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.
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
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]
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?
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();
Hi
I'm looking to show the information window of an marker after the map loading
how can I do it with eventAfterLoad ?
Thanks
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.
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.
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
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?
hi man, i have a problem, i need to capture the Lat and Long from the marker draggable, this is possible to do with that library?
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 ?
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...
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?
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!!!
Hello, can you make views publishable ? For example i need add some options , but i can't...
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..
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.
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.
Hi, how may I use Complex Icon attributes in order to resize the marker?
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.
Hi
how to set an icon to a cluster of markers ?
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
Hello! How i can choose dir for load my views? 👍
Created pull request.
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 [].
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
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
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.
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?
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.