Comments (50)
Can you send me the html output from your browser.
from googlmapper.
Hi there, have you tried adding a css style for height in your containing div, for example:
<div style="height: 200px">{!! Mapper:render () !!}</div>
from googlmapper.
Hi,
Have you setup the facade within app.php as follows?
'Mapper' => Cornford\Googlmapper\Facades\MapperFacade::class
or
'Mapper' => 'Cornford\Googlmapper\Facades\MapperFacade',
Also can you confirm that you are not using the Mapper class, but rather the MapperFacade when utilising the class?
use Cornford\Googlmapper\Facades\MapperFacade as Mapper;
Some IDE's will automatically require the class utilising a use statement at the top of the class without prompting.
from googlmapper.
@bradcornford :Thanks for help and reply i use 'Mapper' => Cornford\Googlmapper\Facades\MapperFacade::class
in my app.php file. the confirmation that you mentioned has solved the issue
but now i see new issue when i need to render may map i do the following in my Controller
$map = Mapper::map(53.381128999999990000, -1.470085000000040000);
and in my view
{!! $map->render() !!}
but now i have nothing to render in my view (Empty), Also i tried to create and render in my controller as the following
$map = Mapper::map(53.381128999999990000, -1.470085000000040000);
$mapRender = $map->render();
and in view
{!! $mapRender !!}
Also The Same Thing (Empty)
from googlmapper.
@3a6ala That's okay. You don't have to set a variable for the map. You just call the methods on Mapper object as follows:
Within you controller:
Mapper::map(53.381128999999990000, -1.470085000000040000);
Within your view:
{!! Mapper::render() !!}
from googlmapper.
@bradcornford : big thank for you about your help and support, now it's working
from googlmapper.
Why is the map not rendering? Anyone can help
Here is my controller
public function index()
{
//
$books=Book::all();
$mapArrays=DB::table('tbmap')->get();
// Draw a map
//Mapper::map(50, 0, ['marker' => false]);
// Add information window for each address
foreach ($mapArrays as $mapArray)
Mapper::map($mapArray->latitude, $mapArray->longitude);
return view('books.index',compact('books'));
}
and my view is:
{!! Mapper::render() !!}
from googlmapper.
@bradcornford @3a6ala Why is the map not rendering? Anyone can help
Here is my controller
public function index()
{
//
$books=Book::all();
$mapArrays=DB::table('tbmap')->get();
// Draw a map
//Mapper::map(50, 0, ['marker' => false]);
// Add information window for each address
foreach ($mapArrays as $mapArray)
Mapper::map($mapArray->latitude, $mapArray->longitude);
return view('books.index',compact('books'));
}
and my view is:
{!! Mapper::render() !!}
from googlmapper.
Hi,
What version of Laravel are you using?
I would also change your code to something along the lines of:
public function index()
{
$books = Book::all();
$mapArrays = DB::table('tbmap')->get();
Mapper::map($mapArrays->first()->latitude, $mapArrays->first()->longitude, ['marker' => false]);
// Add information window for each address
foreach ($mapArrays as $mapArray) {
Mapper::marker($mapArray->latitude, $mapArray->longitude);
}
return view('books.index',compact('books'));
}
from googlmapper.
@bradcornford 5.2
from googlmapper.
@bradcornford Let me try the one you have sent. Thanks
from googlmapper.
@bradcornford
FatalErrorException in BookController.php line 28: Call to a member function first() on a non-object
Line 28 is: Mapper::map($mapArrays->first()->latitude, $mapArrays->first()->longitude, ['marker' => false]);
Below is my controller class. Thanks
class BookController extends Controller
{
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$books = Book::all();
$mapArrays = DB::table('tbmap')->get();
Mapper::map($mapArrays->first()->latitude, $mapArrays->first()->longitude, ['marker' => false]);
// Add information window for each address
foreach ($mapArrays as $mapArray) {
Mapper::marker($mapArray->latitude, $mapArray->longitude);
}
return view('books.index',compact('books'));
}
from googlmapper.
Okay, i assumed it was a Collection object, try this:
public function index()
{
$books = Book::all();
$mapArrays = DB::table('tbmap')->get();
$firstMapItem = reset($mapArrays);
Mapper::map($firstMapItem->latitude, $firstMapItem->longitude, ['marker' => false]);
// Add information window for each address
foreach ($mapArrays as $mapArray) {
Mapper::marker($mapArray->latitude, $mapArray->longitude);
}
return view('books.index',compact('books'));
}
from googlmapper.
@bradcornford Let me try this. Thanks
from googlmapper.
I also have a question, there are many google Map API keys, but I have chosen for the browser. I hope I have chosen the correct key. Thanks
It is displaying nothing. Here is my Controller
get(); ``` $firstMapItem = reset($mapArrays); Mapper::map($firstMapItem->latitude, $firstMapItem->longitude, ['marker' => false]); // Add information window for each address foreach ($mapArrays as $mapArray) { Mapper::marker($mapArray->latitude, $mapArray->longitude); } return view('books.index',compact('books')); } /** * Show the form for creating a new resource. * * @return Response */ public function create() { return view('books.create'); } /** * Store a newly created resource in storage. * * @return Response */ public function store() { $book=Request::all(); Book::create($book); return redirect('books'); } /** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $book=Book::find($id); return view('books.show',compact('book')); } /** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // } /** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $bookUpdate=Request::all(); $book=Book::find($id); $book->update($bookUpdate); return redirect('books'); } /** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // Book::find($id)->delete(); return redirect('books'); } ``` }from googlmapper.
Can you show me your view? Also, your API key would have to be linked to your domain too.
from googlmapper.
@bradcornford I don't have a domain name at the moment. I am using localhost
This is my view.
@extends('layout/default')
@section('content')
{!! Mapper::render() !!}
@endsection
/*
|--------------------------------------------------------------------------
| Google API Key
|--------------------------------------------------------------------------
|
| A Google API key to link Googlmapper to Google's API.
|
*/
'key' => env('GOOGLE_API_KEY', 'AIzaSyCpklB-0qMlJxTkKlDVX-vVCUUZGzuKKUE'),
from googlmapper.
Everything looks fine. Have you ran through all the installation instructions?
Can you send me the html output from the browser.
from googlmapper.
@bradcornford This is what I am getting from the browser console.
Unknown pseudo-class or pseudo-element '-webkit-inner-spin-button'. Ruleset ignored due to bad selector. bootstrap.min.css:5:1528
Unknown pseudo-class or pseudo-element '-webkit-search-cancel-button'. Ruleset ignored due to bad selector. bootstrap.min.css:5:1762
Unknown property 'orphans'. Declaration dropped. bootstrap.min.css:5:2675
Unknown property 'widows'. Declaration dropped. bootstrap.min.css:5:2684
Unknown property '-moz-osx-font-smoothing'. Declaration dropped. bootstrap.min.css:5:3693
Expected color but found 'auto'. Expected color but found '-webkit-focus-ring-color'. Expected end of value but found '-webkit-focus-ring-color'. Error in parsing value for 'outline'. Declaration dropped. bootstrap.min.css:5:15722
Expected end of value but found '\9 '. Error in parsing value for 'margin-top'. Declaration dropped. bootstrap.min.css:5:35565
Expected color but found 'auto'. Expected color but found '-webkit-focus-ring-color'. Expected end of value but found '-webkit-focus-ring-color'. Error in parsing value for 'outline'. Declaration dropped. bootstrap.min.css:5:35809
Unknown pseudo-class or pseudo-element '-ms-input-placeholder'. Ruleset ignored due to bad selector. bootstrap.min.css:5:36740
Unknown pseudo-class or pseudo-element '-webkit-input-placeholder'. Ruleset ignored due to bad selector. bootstrap.min.css:5:36788
Expected media feature name but found '-webkit-min-device-pixel-ratio'. bootstrap.min.css:5:37110
Expected end of value but found '\9 '. Error in parsing value for 'margin-top'. Declaration dropped. bootstrap.min.css:5:38175
Unknown property 'touch-action'. Declaration dropped. bootstrap.min.css:5:44901
Unknown property 'user-select'. Declaration dropped. bootstrap.min.css:5:45009
Expected color but found 'auto'. Expected color but found '-webkit-focus-ring-color'. Expected end of value but found '-webkit-focus-ring-color'. Error in parsing value for 'outline'. Declaration dropped. bootstrap.min.css:5:45210
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:45576
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:54724
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:83179
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:83365
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:84084
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:84270
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:84710
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:84896
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:85342
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:85528
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:85972
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:86158
Unknown property 'zoom'. Declaration dropped. bootstrap.min.css:5:86594
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:102365
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:102474
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:103683
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:103736
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:104693
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:104739
Expected media feature name but found 'transform-3d'. bootstrap.min.css:5:108394
Expected media feature name but found '-webkit-transform-3d'. bootstrap.min.css:5:108409
Error in parsing value for 'perspective'. Declaration dropped. bootstrap.min.css:5:108685
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:109696
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:109765
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:109852
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:109934
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:110111
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:110308
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:110395
Error in parsing value for 'background-image'. Declaration dropped. bootstrap.min.css:5:110477
Expected 'none', URL, or filter function but found 'progid'. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:110654
Expected 'none', URL, or filter function but found 'alpha('. Error in parsing value for 'filter'. Declaration dropped. bootstrap.min.css:5:110879
Expected end of value but found '\9 '. Error in parsing value for 'background-color'. Declaration dropped. bootstrap.min.css:5:111833
Error in parsing value for 'background'. Declaration dropped.
from googlmapper.
They all appear to be css errors, not JS errors.
from googlmapper.
Okay. Let me reinstall the GooglMapper
Thanks
from googlmapper.
Why did I get this error?
C:\wamp\bin\php\php5.5.12\php.exe artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider"
Nothing to publish for tag [].
Process finished with exit code 0 at 15:22:31.
Execution time: 4,553 ms.
from googlmapper.
@bradcornford Why did I get this error when installing the Library?
C:\wamp\bin\php\php5.5.12\php.exe artisan vendor:publish --provider="Cornford\Googlmapper\MapperServiceProvider"
Nothing to publish for tag [].
Process finished with exit code 0 at 15:22:31.
Execution time: 4,553 ms.
from googlmapper.
Thats not an error.
from googlmapper.
Can you ensure you run:
composer install
composer update
from googlmapper.
Ok. Thanks a lot.
from googlmapper.
@bradcornford why is this statement not changing on the browser?
{!! Mapper::render() !!}
from googlmapper.
hi brad,
I use {!! Mapper::render() !!} 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? Below is my view
@extends('layouts.dashboard')
@section('page_heading','Dashboard')
@section('section')
@foreach( $mapArrays as $mapArray)
{{$mapArray->latitude }}
{{$mapArray->longitude }}
@endforeach
{!! Mapper::render() !!}
thank you!
from googlmapper.
No, according to Laravel's documentation (https://laravel.com/docs/5.2/blade#displaying-data), that is correct:
{!! Mapper::render() !!}
from googlmapper.
I am getting this error "ReferenceError: google is not defined".
What's up?
Thanks
On Wed, Feb 10, 2016 at 10:56 AM, Bradley Cornford <[email protected]
wrote:
No, according to Laravel's documentation, that is correct:
{!! Mapper::render() !!}
—
Reply to this email directly or view it on GitHub
#18 (comment)
.
from googlmapper.
ReferenceError: google is not defined
When I click it, it takes me to this line
"google.maps.event.addDomListener(window, 'load', initialize_0);" on the
code below. Thanks
<link href="
http://localhost/laravcrime/public/css/bootstrap-3.3.5.min.css"
rel="stylesheet">
<style>
body {
/* Bootstrap fix for navbar-fixed-top */
padding-top: 70px;
}
</style>
Lara Crime Watch
sasa mtu yangu<script type="text/javascript" src="// maps.googleapis.com/maps/api/js?v=3.exp®ion=GB&language=en-gb&key=AIzaSyCpklB-0qMlJxTkKlDVX-vVCUUZGzuKKUE&signed_in=false&libraries=places "></script> <script type="text/javascript" src="// googlemaps.github.io/js-marker-clusterer/src/markerclusterer.js"></script> <script type="text/javascript"> var maps = []; function initialize_0() { var bounds = new google.maps.LatLngBounds(); var infowindow = new google.maps.InfoWindow(); var position = new google.maps.LatLng(-1.292066, 36.821946); var mapOptions_0 = { center: position, mapTypeId: google.maps.MapTypeId.ROADMAP, disableDefaultUI: false , scrollwheel: true }; var map_0 = new google.maps.Map(document.getElementById('map-canvas-0'), mapOptions_0); map_0.setTilt(90); var markers = []; var markerPosition_0 = new google.maps.LatLng(-1.292066, 36.821946); var marker_0 = new google.maps.Marker({ position: markerPosition_0, title: '', animation: '' , icon: '' }); bounds.extend(marker_0.position); marker_0.setMap(map_0); markers.push(marker_0); var markerCluster = new MarkerClusterer(map_0, markers); var listener = google.maps.event.addListener(map_0, "idle", function () { map_0.setZoom(8); google.maps.event.removeListener(listener); }); maps.push({ key: 0, markers: markers, map: map_0 }); } google.maps.event.addDomListener(window, 'load', initialize_0); </script>
</div>
On Wed, Feb 10, 2016 at 4:48 PM, Bradley Cornford [email protected]
wrote:
Can you send me the html output from your browser.
—
Reply to this email directly or view it on GitHub
#18 (comment)
.
@maina kanyi
from googlmapper.
Hi, I've tested your code, and the only problem i can see is that you aren't displaying the map in a div with any CSS set for height or width. Add this to you code:
<style>
#map-canvas-0 {
height: 500px !important;
}
</style>
from googlmapper.
Ok. Thank you so much
On Thu, Feb 11, 2016 at 12:21 PM, Bradley Cornford <[email protected]
wrote:
Hi, I've tested your code, and the only problem i can see is that you
<style> #map-canvas-0 { height: 500px !important; } </style>
aren't displaying the map in a div with any CSS set for height or width.
Add this to you code:—
Reply to this email directly or view it on GitHub
#18 (comment)
.
from googlmapper.
Sorry its taken so long to find a solution!
from googlmapper.
@bradcornford
I am getting this error "InvalidValueError: initMap is not a function"
I have referenced Google map API this way
<script src="https://maps.googleapis.com/maps/api/js?callback=initMap" async defer></script>How can I solve this problem. Thanks
from googlmapper.
I'm not sure, maybe this is of help to you:
http://stackoverflow.com/questions/34466718/googlemaps-does-not-load-on-page-load
from googlmapper.
the map doesn't show , there isn't any error ,, !!
from googlmapper.
@engsamar Have you tried adding this to your calling class:
use Cornford\Googlmapper\Facades\MapperFacade as Mapper;
Also ensure you have a Google API Key that hasn't reached its quota.
from googlmapper.
Sorry, it worked
Sent from Samsung Mobile
-------- Original message --------
From: Bradley Cornford [email protected]
Date: 2016/08/25 3:55 PM (GMT+03:00)
To: bradcornford/Googlmapper [email protected]
Cc: mainakanyi [email protected], Comment [email protected]
Subject: Re: [bradcornford/Googlmapper] Cornford\Googlmapper\Mapper::map()
should not be called statically (#18)
@engsamar Have you tried adding this to your calling class: use Cornford\Googlmapper\Facades\MapperFacade as Mapper; Also ensure you have a Google API Key that hasn't reached its quota. —You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.
from googlmapper.
i don't understand how to use it . i try the code to display map {!!
Mapper::render()!!}
does'nt work
how can i display more than places in the same map
thank you for interests
2016-08-25 15:13 GMT+02:00 mainakanyi [email protected]:
Sorry, it worked
Sent from Samsung Mobile
-------- Original message --------
From: Bradley Cornford [email protected]
Date: 2016/08/25 3:55 PM (GMT+03:00)
To: bradcornford/Googlmapper [email protected]
Cc: mainakanyi [email protected], Comment <
[email protected]>
Subject: Re: [bradcornford/Googlmapper] Cornford\Googlmapper\Mapper::map()
should not be called statically (#18)@engsamar Have you tried adding this to your calling class: use
Cornford\Googlmapper\Facades\MapperFacade as Mapper; Also ensure you have
a Google API Key that hasn't reached its quota. —You are receiving this
because you commented.Reply to this email directly, view it on GitHub, or
mute the thread.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#18 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/APvqdDR75fjoGhSIrbZqGSiOWsgkfTZ_ks5qjZUHgaJpZM4GifcQ
.
from googlmapper.
Hi @bradcornford I tried your instructions but I cannot see the maps on my view. But when I inspect element, I can see the javascript but it's not showing on front end. Can you please help me? Thanks.
from googlmapper.
@bradcornford thanks it's now showing!
from googlmapper.
hi @bradcornford How to make the maps responsive? And also, how do I dismiss an infowindow if another window is displayed?
from googlmapper.
Hi,
You should be able to make the maps responsive by putting them in responsive containers using CSS.
As for auto dismissal of information windows, i don't think this is currently possible. I will however raise an issue to look into this further.
from googlmapper.
@bradcornford thanks for your response!
from googlmapper.
Is it possible to make more than one marker in same window (Map)?
from googlmapper.
Hi there,
Yes this is possible, you can call there method Mapper::marker as many times as you require.
For example:
Mapper::map (1,1);
Mapper::marker(1.1,1.1);
Mapper::marker(1.2,1.2);
from googlmapper.
how to create a multiple polyline in the same map
from googlmapper.
Good Morning.
how to stylize the marker label, tinker in the css pain marker properties?
from googlmapper.
hi, can u help me? how to make radius from current location to see someplaces arround user location?
from googlmapper.
Related Issues (20)
- Map Drag Event (Livewire) HOT 3
- Can you get lat/lng of clicked location? HOT 1
- Map not rendering when parent element is hidden HOT 1
- Map disappers when changing livewire model HOT 6
- gpx HOT 1
- Display KML/KMZ HOT 3
- Error Google Maps JavaScript API error: InvalidKeyMapError HOT 2
- Cornford\Googlmapper\Exceptions\MapperInstanceException No map found to add a polyline to. HOT 3
- Add new icon by click on the map view
- Drawing Layer (Library) HOT 1
- Laravel 9 support: illuminate/support v9.0? HOT 3
- Add listener 'click' on polyline ?
- DrawingManager Displayed twice based on React-18 upgrade HOT 1
- Re-rendering google
- eventClick on marker get Zoom
- Recenter Map With Livewire HOT 3
- labelClass doesnt work
- Bad Method Call Exception - Method Illuminate\Foundation\Application::share does not exist.
- Laravel 10 HOT 4
- Laravel 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from googlmapper.