Git Product home page Git Product logo

ivory-google-map's Introduction

README

Travis Build Status AppVeyor Build status Code Coverage Scrutinizer Code Quality Dependency Status

Latest Stable Version Latest Unstable Version Total Downloads License

Overview

The Ivory Google Map project provides a Google Map integration for your PHP 5.6+ project. It allows you to manage map, controls, overlays, events & services through the Google Map API v3.

use Ivory\GoogleMap\Helper\Builder\ApiHelperBuilder;
use Ivory\GoogleMap\Helper\Builder\MapHelperBuilder;
use Ivory\GoogleMap\Map;

$map = new Map();

$mapHelper = MapHelperBuilder::create()->build();
$apiHelper = ApiHelperBuilder::create()
    ->setKey('API_KEY')
    ->build();

echo $mapHelper->render($map);
echo $apiHelper->render([$map]);

Documentation

You're currently browsing the 2.x documentation, if you're using the 1.x, read this documentation instead.

Testing

The library is fully unit tested by PHPUnit with a code coverage close to 100%. To execute the test suite, check the travis configuration.

Contribute

We love contributors! Ivory is an open source project. If you'd like to contribute, feel free to propose a PR! You can follow the CONTRIBUTING file which will explain you how to set up the project.

License

The Ivory Google Map is under the MIT license. For the full copyright and license information, please read the LICENSE file that was distributed with this source code.

ivory-google-map's People

Contributors

apaccou avatar askozienko avatar benr77 avatar daviddlv avatar dergus avatar gelolabs avatar ghua avatar gregurco avatar hamid80386 avatar igormukhingmailcom avatar johnnypeck avatar masthodont avatar mykehsd avatar noogic avatar nyholm avatar rowdyelectron avatar rychlik avatar tyler-sommer avatar vv12131415 avatar xwb avatar younesnait avatar zavan 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ivory-google-map's Issues

multilingual support in GeocoderProvider

wish we could set language option in GeocoderProvider as well. Instead of sending my pull-request, I'd like to briefly mention what i'd like to do here.

in GeocoderProvider's class

protected $language; // (1) added property for language option

public function __construct(HttpAdapterInterface $adapter, $locale = 'en')
{
    parent::__construct($adapter, $locale);

    $this->url = 'http://maps.googleapis.com/maps/api/geocode';
    $this->https = false;
    $this->format = 'json';
    $this->language = $locale; // (2) save the language option
}
:

public function getGeocodedData($request)
{
    if (is_string($request)) {
        $geocoderRequest = new GeocoderRequest();
        $geocoderRequest->setLanguage($this->language); // (3) set it accordingly
:

public function getReversedData(array $coordinates)
{
    $request = new GeocoderRequest();
    $request->setLanguage($this->language); // (4) same as above
: 

Then, later, we could use the language option like

$map = new Map();
$map->setLanguage('ko'); // e.g. Korean

$geocoder = new Geocoder();
$geocoder->registerProviders(array(
new GeocoderProvider(new CurlHttpAdapter(), $map->getLanguage()),
));

What do you think???

Elevation API support?

Just started using this library and it's really excellent, impressed with how well thought through and documented everything is. Great job!

I was wondering if you had any plans to add support for the Elevation API? I need it for the project I'm working on currently - if you aren't planning on adding it any time soon I will try and fork it and add it myself but just wanted to check it's not something you've already got in the pipeline, as it seems to be the only major service missing that I can see.

Many thanks for putting this together! Has saved me loads of time already.

Unable to style marker clusters

In JsMarkerClusterHelper the options are json encoded with the FORCE_OBJECT parameter (https://github.com/egeloen/ivory-google-map/blob/master/src/Ivory/GoogleMap/Helper/Overlays/MarkerCluster/JsMarkerClusterHelper.php#L38)

This way custom styles cannot be configured as google expects an indexed array (not associative).

The styles option is rendered as "styles": {"0": {"key": "valye"}} however "styles": [{"key": "value"}] is expected.

Please fix in master (cant you use the JsonBuilder util?)

Roland,

use ivory-google-map as a input

Hi i install this Bundle and try use in form but without succes :

(in sonata admin)

// src/Miejsce/ObiektyBundle/Admin/ObiektyAdmin.php
use Ivory\GoogleMap\Places\AutocompleteType;

..

protected function configureFormFields(FormMapper $formMapper)

->add('adres','places_autocomplete')

but have :

Could not load type "places_autocomplete" in site - how to use it ?

Undefined method

[error] 10089#0: *532 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Call to a member function getJavascriptVariable() on a non-object in /proyectos/candgo/vendor/egeloen/google-map/src/Ivory/GoogleMap/Helper/MapHelper.php on line 1307

Origin and Destinations are switched in response of DistanceMatrix API.

Response is displaying origin as destination and destination as origin.

File: ivory-google-map-master/src/Ivory/GoogleMap/Services/DistanceMatrix/DistanceMatrix.php

protected function buildDistanceMatrixResponse(\stdClass $distanceMatrixResponse)
{
    $status = $distanceMatrixResponse->status;
    $destinations = $distanceMatrixResponse->destination_addresses;
    $origins = $distanceMatrixResponse->origin_addresses;
    $rows = $this->buildDistanceMatrixRows($distanceMatrixResponse->rows);

    return new DistanceMatrixResponse($status,$destinations,$origin,$rows);
}

Order of the return parameter is wrong when passing to DistanceMatrixResponse..

What's going on with versioning?

As someone who is starting to use this in a rather large code-base I'd like to clarify a few points:

  • Is there going to be a 1.3.1, or is it going 1.3.0 to 1.4.0?
  • Does this project follow sem-ver?
  • Which version is recommended to be used right now? How soon until the next release would you like to guess?

access the container from jQuery or other third party.

Hello,

I'd like to access the container from jquery.
I set the javascriptvariable to something so I don't have a uniqid in the container name.
But now I'd like to access the map. For example change the zoom level based on a user click on a button monitored by jQuery.
So I could do something like mymap_container.map.setZoom(12);
The container is wrapped into the function load_ivory_google_map() so I can't access it from jQuery.

Any tips would be great. Thx you.

How to find best routes among locations

AS per my requirement,i will have a origin as my start point and i have list of locations like L1,L2,L3,L4,L5,L6,L7 where i should drop my courier.

I need to find the best route for this scenario.

In this case i am not having propoer destinaltion point.
based upon the best route from google i will determine my destination.
Can one suggest me how to achieve this?

Adding places within entity attribute

I want to save the autocompleted address in an Entity whithin "my_field" attribute.
In its XXXType.php I've followed the doc and put this :

// ..
$builder
->add('my_field', 'places_autocomplete', array( 'prefix' => 'js_prefix_',

                                                            'types'  => array(
                                                                AutocompleteType::CITIES,
                                                            ),
                                                            'async' => false,
                                                            'language' => 'fr',
        ));
    ; 

//..

"my_field" attribute's type is string. So when the form is submitted it tells me that the conversion from array to string is an issue.
Error : "Notice: Array to string conversion in C:\wamp\www\XXX\vendor\doctrine\dbal\lib\Doctrine\DBAL\Statement.php line 103"

It would be very nice to help me solve this problem.

DistanceMatrix - max character length in API URL

Hello there,
this is my first issue on Github, so forgive me please for my mistakes.

The bug appears when you provide origins or destinations which exceed max URL length provided by Google DistanceMatrix Webservice. Nowadays limit is set to ~2000 characters per request (after URL Encoding) - https://developers.google.com/maps/documentation/distancematrix/#Limits

Process method in DistanceMatrix class is not checking condition (length) of generated URL, method checks only responde of httpAdapter->getContent() method - which in this way returns HTML, but that HTML is Google error page with status code 400.

Can I provide pull request to fix that?

Impossible to set $javascriptVariable

In AbstractJavascriptVariableAsset you can set $javascriptVariable in constructor.
Unfortunately, you cannot do the same in Map.php constructor.
It would be nice to get the opportunity to pass the same $javascriptVariable to Map.php constructor (that would need to call parent::__construct), so you can fix $javascriptVariable and avoid a random value (useful for caching purposes)

geocoding provider

I'm trying to use ivory-google-map with laravel4.

when i try to use it, it return : No Provider Registred.

To test this, i've added

use Ivory\GoogleMap\Services\Geocoding\Geocoder;

$geocoder = new Geocoder();

var_dump($geocoder->geocode($input));

And i think there is an error in documentation :

use Ivory\GoogleMap\Services\Geocoding\Geocoder;

use $geocoder = new Geocoder();

This is a var_dump($geocoder) :

object(Ivory\GoogleMap\Services\Geocoding\Geocoder)#343 (4) {
  ["providers":"Geocoder\Geocoder":private]=>
  array(0) {
  }
  ["provider":"Geocoder\Geocoder":private]=>
  NULL
  ["resultFactory":"Geocoder\Geocoder":private]=>
  object(Geocoder\Result\DefaultResultFactory)#344 (0) {
  }
  ["maxResults":"Geocoder\Geocoder":private]=>
  int(5)
}

Dependency installation error via Composer

I am getting the following error while installing this component with Composer.

 [Composer\Downloader\TransportException]                                     
  The "https://api.github.com/repos/symfony/PropertyAccess/zipball/2749512341  
  50e303c83099a2429be6be35629fe9" file could not be downloaded (HTTP/1.0 500   
  Internal Server Error)     

And when I tried to put https://api.github.com/repos/symfony/PropertyAccess/zipball/2749512341 50e303c83099a2429be6be35629fe9 url in browser then also it shows Internal Server Error. I think in your composer.json file should be updated for symfony/propertyaccess dependency module.

Thanks.

Only one map in foreach.

Hello,

First of all I would like to say thank you for great library!

But I have some problems. I am using this library to show map for each registered user. But in all user list only one map is showing.

This is my method:

public function findCompaniesAction() {
    $em = $this->getDoctrine()->getManager();

    $companies = $em->createQueryBuilder()
        ->select('b')
        ->from('RFQIronilBundle:User',  'b')
        ->where('b.acc_type = 1')
        ->getQuery()
        ->getResult();

    foreach ($companies as $key => $company) {
        $map = $this->get('ivory_google_map.map');
        $map->setMapOption('mapTypeId', MapTypeId::ROADMAP);
        $map->setMapOption('mapTypeId', 'roadmap');
        $company->map = $map;
    }

    return $this->render('RFQIronilBundle:Default:find-companies.html.twig', array(
        'companies'     => $companies
    ));
}

and in my view I use:

{% for companies in companies %}
{{ google_map_container(companies.map) }}
{{ google_map_js(companies.map) }}
{% endfor %}

All is fine, but map is showing for only first user. What I have missed?

Map load incorrect if we place it in hidden div (tab)

This problems happens if map loading when on load moment he is inside invisible DOM element. I don't find solution for reload map.

Possible solution:
{{ google_map_js(map) }} - generated script like this:

<script type="text/javascript">...</script>

If this part can be changed to:

<script type="text/javascript">
    function init_map_MAPID() {
        ...
    }
    init_map_MAPID();
</script>

or something like this, than map can be reloaded when needed with generated function call.

Rewrite json generation

The aim of all helpers is to generate javascript & lot of json. The json is all time generated using concatenation due to some string which are not json string but a reference to a variable or sometimes a function. So, I can't simply use json_encode...

IMO, the library should provide a json builder which allows to manage this part making all helpers much more readable & maintainable.

Conflict with styles

I'm trying to use the infowindow, but when i show in the map after assign to a marker, doesnt view good the style and is really awfull, this i'm not sure if is an error of my css, or have any conflict with this, but i can't udnerstand, are any solution?
captura de pantalla 2013-09-23 a la s 15 10 19

Fatal error: Class 'Geocoder\Geocoder' not found in /vendor/egeloen/google-map/src/Ivory/GoogleMap/Services/Geocoding/Geocoder.php on line 23

When i use the Geocoder tell me this errors, and i don't know if i'm doing anything wrong, i'm using the symfony bundle, but i don't have any idea, this is the code:

    $geocoder = new Geocoder();
    $geocoder->registerProviders(array(
        new GeocoderProvider(new CurlHttpAdapter()),
    ));

    // Geocode an address
    $response = $geocoder->geocode('1600 Amphitheatre Parkway, Mountain View, CA');

Error with last update

Catchable fatal error: Argument 1 passed to Ivory\GoogleMap\Helper\MapHelper::__construct() must be an instance of Ivory\GoogleMap\Helper\ApiHelper, instance of Ivory\GoogleMap\Helper\Base\CoordinateHelper given

it seems that the service ivory_google_map.helper.map, at map.xml, don't receive the first param

InfoBox support + extension

Currently, the lib only supports native google map info window or IMO, we can provide an easy implementation which will not introduce BC and at the same time add a new feature: extension.

For the info box part, my point of view is simple: replace the InfoWinfowHelper implementation by an other one. So, to enable the info box behavior, just need to instantiate the appropriate helper.

But now, if we generate info box objects instead of info windows, we need to load the info box library or an info window helper can not dot that... We're fucked...

Extension to the rescue! An extension will basically solve egeloen/IvoryGoogleMapBundle#82 by allowing to render custom libraires & add some custom code just before & after the generated code.

Then, we can create an InfoBoxExtension which will load the library & then all should work for info box.

Override bundle

Hello,

I'd like to override the google-bundle which generates the js cause I'd like to rewrite it in jQuery for the need of my projet.

Can you tell me how to do it without touching the vendor bundle ?

I tried to extend googlemapbundle in my Application/Ivory/GoogleMapBundle but I'm not able to hook the Helper/TemplateHelper for example.

Can you give me some tips ?

Infoview doesn't work

Last update, might have crashed it, becouse before it work's perfect, here it's the code generated by the render

map_515b04d0b779f_container = {"map":null,"coordinates":{},"bounds":{},"points":{},"sizes":{},"circles":{},"encoded_polylines":{},"ground_overlays":{},"polygons":{},"polylines":{},"rectangles":{},"info_windows":{},"marker_images":{},"marker_shapes":{},"markers":{},"kml_layers":{},"event_manager":{"dom_events":{},"dom_events_once":{},"events":{},"events_once":{}},"closable_info_windows":{}};
map_515b04d0b779f_container.coordinates.coordinate_515b04d0b6007 = coordinate_515b04d0b6007 = new google.maps.LatLng(39.300299, -2.856445, true);
map_515b04d0b779f_container.coordinates.coordinate_515b04d0bc189 = coordinate_515b04d0bc189 = new google.maps.LatLng(36.530533, -6.291897, false);
map_515b04d0b779f_container.coordinates.coordinate_515b04d0c6fb5 = coordinate_515b04d0c6fb5 = new google.maps.LatLng(40.452302, -3.687715, false);
map_515b04d0b779f_container.coordinates.coordinate_515b04d0c7521 = coordinate_515b04d0c7521 = new google.maps.LatLng(41.380485, 2.121590, false);
map_515b04d0b779f_container.coordinates.coordinate_515b04d0c7a64 = coordinate_515b04d0c7a64 = new google.maps.LatLng(40.423308, -3.672402, false);
map_515b04d0b779f_container.sizes.size_515b04d0bf5e9 = size_515b04d0bf5e9 = new google.maps.Size(1.1, 2.1, "px", "pt");
map_515b04d0b779f_container.sizes.size_515b04d0c71e3 = size_515b04d0c71e3 = new google.maps.Size(1.1, 2.1, "px", "pt");
map_515b04d0b779f_container.sizes.size_515b04d0c77bd = size_515b04d0c77bd = new google.maps.Size(1.1, 2.1, "px", "pt");
map_515b04d0b779f_container.sizes.size_515b04d0c7cf7 = size_515b04d0c7cf7 = new google.maps.Size(1.1, 2.1, "px", "pt");
map_515b04d0b779f_container.map = map_515b04d0b779f = new google.maps.Map(document.getElementById("map_canvas"), {"mapTypeId":google.maps.MapTypeId.ROADMAP,"zoom":5,"disableDefaultUI":false,"disableDoubleClickZoom":false});
map_515b04d0b779f.setCenter(coordinate_515b04d0b6007);
map_515b04d0b779f_container.info_windows.info_window_515b04d0bf4f5 = info_window_515b04d0bf4f5 = new google.maps.InfoWindow({"pixelOffset":size_515b04d0bf5e9,"content":"<h4>Carranza<\/h4><a href=\/poc-1-0\/>poc 1 0<\/a><br><a href=\/poc-1-0\/>poc 1 0<\/a><br><a href=\/poc-2-2\/>poc 2 2<\/a><br><a href=\/poc-2-2\/>poc 2 2<\/a><br><a href=\/poc-2-3\/>poc 2 3<\/a><br><a href=\/poc-2-3\/>poc 2 3<\/a><br><a href=\/poc-2-3\/>poc 2 3<\/a><br><a href=\/poc-3-2\/>poc 3 2<\/a><br>","open":false,"disableAutoPan":false,"zIndex":10});
map_515b04d0b779f_container.info_windows.info_window_515b04d0c712c = info_window_515b04d0c712c = new google.maps.InfoWindow({"pixelOffset":size_515b04d0c71e3,"content":"<h4>Estadio Santiago Bernab\u00e9u<\/h4><a href=\/poc-0-0\/>poc 0 0<\/a><br><a href=\/poc-2-0\/>poc 2 0<\/a><br><a href=\/poc-2-1\/>poc 2 1<\/a><br><a href=\/poc-3-1\/>poc 3 1<\/a><br><a href=\/poc-3-2\/>poc 3 2<\/a><br><a href=\/poc-3-3\/>poc 3 3<\/a><br><a href=\/poc-3-3\/>poc 3 3<\/a><br><a href=\/poc-3-3\/>poc 3 3<\/a><br><a href=\/poc-3-3\/>poc 3 3<\/a><br><a href=\/poc-0-1001\/>poc 0 1001<\/a><br>","open":false,"disableAutoPan":false,"zIndex":10});
map_515b04d0b779f_container.info_windows.info_window_515b04d0c76de = info_window_515b04d0c76de = new google.maps.InfoWindow({"pixelOffset":size_515b04d0c77bd,"content":"<h4>Estadio Nou Camp<\/h4><a href=\/poc-1-0\/>poc 1 0<\/a><br><a href=\/poc-1-0\/>poc 1 0<\/a><br><a href=\/poc-1-1\/>poc 1 1<\/a><br><a href=\/poc-1-2\/>poc 1 2<\/a><br><a href=\/poc-1-3\/>poc 1 3<\/a><br><a href=\/poc-2-0\/>poc 2 0<\/a><br><a href=\/poc-2-3\/>poc 2 3<\/a><br>","open":false,"disableAutoPan":false,"zIndex":10});
map_515b04d0b779f_container.info_windows.info_window_515b04d0c7c19 = info_window_515b04d0c7c19 = new google.maps.InfoWindow({"pixelOffset":size_515b04d0c7cf7,"content":"<h4>Palacio de Deportes<\/h4><a href=\/poc-0-1\/>poc 0 1<\/a><br><a href=\/poc-0-1\/>poc 0 1<\/a><br><a href=\/poc-0-2\/>poc 0 2<\/a><br><a href=\/poc-0-3\/>poc 0 3<\/a><br><a href=\/poc-1-1\/>poc 1 1<\/a><br><a href=\/poc-1-1\/>poc 1 1<\/a><br><a href=\/poc-1-3\/>poc 1 3<\/a><br><a href=\/poc-2-1\/>poc 2 1<\/a><br><a href=\/poc-2-2\/>poc 2 2<\/a><br><a href=\/poc-3-0\/>poc 3 0<\/a><br><a href=\/poc-3-2\/>poc 3 2<\/a><br><a href=\/poc-3-2\/>poc 3 2<\/a><br>","open":false,"disableAutoPan":false,"zIndex":10});
map_515b04d0b779f_container.closable_info_windows.info_window_515b04d0bf4f5 = info_window_515b04d0bf4f5;
map_515b04d0b779f_container.closable_info_windows.info_window_515b04d0c712c = info_window_515b04d0c712c;
map_515b04d0b779f_container.closable_info_windows.info_window_515b04d0c76de = info_window_515b04d0c76de;
map_515b04d0b779f_container.closable_info_windows.info_window_515b04d0c7c19 = info_window_515b04d0c7c19;
map_515b04d0b779f_container.markers.marker_515b04d0bc1f5 = marker_515b04d0bc1f5 = new google.maps.Marker({"map":map_515b04d0b779f,"position":coordinate_515b04d0bc189,"clickable":true,"flat":false});
map_515b04d0b779f_container.markers.marker_515b04d0c700f = marker_515b04d0c700f = new google.maps.Marker({"map":map_515b04d0b779f,"position":coordinate_515b04d0c6fb5,"clickable":true,"flat":false});
map_515b04d0b779f_container.markers.marker_515b04d0c7582 = marker_515b04d0c7582 = new google.maps.Marker({"map":map_515b04d0b779f,"position":coordinate_515b04d0c7521,"clickable":true,"flat":false});
map_515b04d0b779f_container.markers.marker_515b04d0c7ac3 = marker_515b04d0c7ac3 = new google.maps.Marker({"map":map_515b04d0b779f,"position":coordinate_515b04d0c7a64,"clickable":true,"flat":false});
map_515b04d0b779f_container.event_manager.events.marker_515b04d0bc1f5_info_window_event = marker_515b04d0bc1f5_info_window_event = google.maps.event.addListener(marker_515b04d0bc1f5, "click", function () {
    for (var info_window in map_515b04d0b779f_container.closable_info_windows) {
        map_515b04d0b779f_container.closable_info_windows[info_window].close();
    }
    info_window_515b04d0bf4f5.open(map_515b04d0b779f, marker_515b04d0bc1f5);

});
map_515b04d0b779f_container.event_manager.events.marker_515b04d0c700f_info_window_event = marker_515b04d0c700f_info_window_event = google.maps.event.addListener(marker_515b04d0c700f, "click", function () {
    for (var info_window in map_515b04d0b779f_container.closable_info_windows) {
        map_515b04d0b779f_container.closable_info_windows[info_window].close();
    }
    info_window_515b04d0c712c.open(map_515b04d0b779f, marker_515b04d0c700f);

});
map_515b04d0b779f_container.event_manager.events.marker_515b04d0c7582_info_window_event = marker_515b04d0c7582_info_window_event = google.maps.event.addListener(marker_515b04d0c7582, "click", function () {
    for (var info_window in map_515b04d0b779f_container.closable_info_windows) {
        map_515b04d0b779f_container.closable_info_windows[info_window].close();
    }
    info_window_515b04d0c76de.open(map_515b04d0b779f, marker_515b04d0c7582);

});
map_515b04d0b779f_container.event_manager.events.marker_515b04d0c7ac3_info_window_event = marker_515b04d0c7ac3_info_window_event = google.maps.event.addListener(marker_515b04d0c7ac3, "click", function () {
    for (var info_window in map_515b04d0b779f_container.closable_info_windows) {
        map_515b04d0b779f_container.closable_info_windows[info_window].close();
    }
    info_window_515b04d0c7c19.open(map_515b04d0b779f, marker_515b04d0c7ac3);

});

Map not showing

Hi!

I have an issue - I've installed the bundle, and tried to render it, but the map doesn't show.

This is my controller's code:

namespace My\WebApp\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Ivory\GoogleMap\Map;

class MapController extends Controller
{
    public function indexAction()
    {
        $array = array();
        $map = new Map();
        $array["map"] = $map;
        return $this->render('MyWebApp:map.html.twig', $array);
    }
}

The view generates the Map canvas DIV, but there's no map.
What am I doing wrong?

Markers bound fitting is not working.

I'm using IvoryGoogleMapBundle 2.1 with bounds that should fit marker extends but it's not working.

I tried to investigate the issue and it seems that JavaScript map.fitBounds(bound) should be called after all extends are added to bound object. For now this line is added by MapHelper::renderMapBound method which is called from MapHelper::renderJsContainerMap before MapHelper::renderJsContainerBoundsExtends which adds marker extends is called.

I tried calling fitBounds() after all extends are added and it worked perfectly.

Thanks in advance.

Marker sets - One infowindow open on start ?

 foreach($entity as $e) {
        $marker = $this->get('ivory_google_map.marker');
        $marker->setPosition($e->getLatitude(),$e->getLongitude(),true);

        $infoWindow = new InfoWindow();
        $infoWindow->setAutoOpen(true);
        $infoWindow->setAutoClose(false);

        if($e->getId() == 1) {
            $infoWindow->setOpen(true);
        }
        else{
            $infoWindow->setOpen(false);
        }

        $marker->setInfoWindow($infoWindow);

        $map->addMarker($marker);

...

It dosn't work... Why ?

Map not rendered

I use the library as standalone and I to rendered a map the map doesn't work all the time, I mean that sometimes it's not working, and sometimes it's working (just in Chrome & Firefox - ironically it works perfect in Internet Explorer) when I inspect the element in Chrome (while the map is not working) it gives me this :

Replace MarkerImage by Icon

The MarkerImage has been deprecated in the google map library and we should use Icon instead. The library should provide a BC layer.

Probleme installing "widop/http-adapter"

As I try to update with composer command "composer.phar update" after having replaced "krisswallsmith/buzz : "*" " by "widop/http-adapter: * " in my composer.json file, I get this error :

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "ivory_google_map.directions" has a dependency on a non-existen
t service "widop_http_adapter.curl".

I don't really figure what I have wrong in my code...

Thx.

InfoWindows maxWidth

I can't see any option to set the property maxWidth on infoWindows. My infoWindows are rendered too small and displays scrollbars.

Any idea ?

Weird polygons when added on map

Hi,

I'm having some trouble with the polygons. The code I use:

        $polygon = new Polygon();
        $polygon->setOption('fillColor', '#000000');
        $polygon->setOption('fillOpacity', 0.5);
        $polygon->addCoordinate(52.058718160173306, 4.19677734375, false);
        $polygon->addCoordinate(52.04668422583484, 4.208278656005859, false);
        $polygon->addCoordinate(52.04457267508014, 4.203472137451172, false);
        $polygon->addCoordinate(52.03433023856411, 4.211540222167969, false);
        $polygon->addCoordinate(52.03327418382684, 4.204845428466797, false);
        $polygon->addCoordinate(52.02767667726934, 4.2084503173828125, false);
        $polygon->addCoordinate(52.02926094833158, 4.221153259277344, false);
        $polygon->addCoordinate(52.06162059770389, 4.270763397216797, false);
        $polygon->addCoordinate(52.06225383173855, 4.259519577026367, false);
        $polygon->addCoordinate(52.06061795878833, 4.254884719848633, false);
        $polygon->addCoordinate(52.06283428838372, 4.251537322998047, false);
        $polygon->addCoordinate(52.06499774214766, 4.252138137817383, false);
        $polygon->addCoordinate(52.066897273678855, 4.247074127197266, false);
        $polygon->addCoordinate(52.06879672441445, 4.2510223388671875, false);
        $polygon->addCoordinate(52.07074885347869, 4.2496490478515625, false);
        $polygon->addCoordinate(52.07444183716456, 4.252738952636719, false);
        $polygon->addCoordinate(52.07607720377737, 4.251623153686523, false);
        $polygon->addCoordinate(52.07233159817613, 4.241323471069336, false);
        $polygon->addCoordinate(52.0805609662022, 4.232568740844727, false);
        $polygon->addCoordinate(52.05887647981069, 4.1974639892578125, false);

The following output:
schermafbeelding 2014-03-17 om 16 03 49

Notice the big empty space. When zooming in, more spaces arise. Any idea how to get rid of them? I already tried setting the no-wrap to true.

Multiple Marker problem

Hi, i have the following problem when i try to add more than one marker on the map :

foreach($_aListVenues as $_oVenues){
            $latitude = $_oVenues->venue->location->lat;
            $longitude = $_oVenues->venue->location->lng;
            $_aVenues = array(
                'latitude' => $latitude,
                'longitude' => $longitude,
            );
            $_oMarker = $_oMap->createMarker($_aVenues); // create marker
            var_dump($_oMarker);
            $_oFinalMap->addMarker($_oMarker); // add marker on the map
 }

 var_dump($_oFinalMap->getMarkers());

The first var_dump display the marker as i want with different properties but the second display an array of exactly the same marker like that :

Capture

I've looked into the map class, the markers are added in an array, so why are they overriden when you add them ?

Zoom on kml layer

If you would like zoom map with kmlLayer probably you must add :
$kmlLayer->setOption('preserveViewport',true);

It's correct ?

[Directions] Add XML parser

The Directions only supports the JSON format. As Google Map supports the XML one, we should support it too.

Get full geo information from the autocomplete field

Hi,

for a project i need a places autocomplete field where the user can fill in his whole address. After submitting the form i want to seperate the address in fragments like zipcode, street, city, province etc. At the moment the autocomplete form field only returns the informationen as a string based on the given type. When i render the field with type = geocode, it only returns street + number, city and country.

Is there a way how to solve my problem? Maybe i need an additional geocode request to get the additional data?

Thank you.

Problem with using Autocomplete and Map on same page

Is there a way to have both a map with markers etc as well as an autocomplete places form on the same page? I can get either one to work but not together.

I get "Uncaught TypeError: undefined is not a function" which is probably due to a collision. I see the '<script type="text/javascript" src="//www.google.com/jsapi?callback=load_ivory_google_map_api"></script>' is in there twice and a function "function load_ivory_google_map_api ()" is declared twice with different content.

I am using the following on the page:

{{ $autocompleteHelper->renderJavascripts($autocomplete) }}
{{ $mapHelper->renderJavascripts($map) }}

{{}} are Laravel's blade echo statements.

I am using this in a Laravel project via composer ("egeloen/google-map": "1.4.*@dev")

geoJSON layer?

Google Maps seems to support GeoJSON as a layer now as well. Are there any plans of supporting this as well?

Sending error when using distance API

Hello,

I'm using this bundle through https://github.com/egeloen/IvoryGoogleMapBundle and all was OK up to a few days

When using the distance API, I got this error :
Error: Call to a member function getStatusCode() on a non-object in /my/path/vendor/egeloen/google-map/src/Services/AbstractService.php line 259

When adding a var_dump at this line, of $response :
https://github.com/egeloen/ivory-google-map/blob/master/src/Services/AbstractService.php#L254
the results is :
string(523) "{ "destination_addresses" : [ "Strasbourg, France" ], "origin_addresses" : [ "Illkirch, France" ], "rows" : [ { "elements" : [ { "distance" : { "text" : "13,6 km", "value" : 13590 }, "duration" : { "text" : "18 minutes", "value" : 1087 }, "status" : "OK" } ] } ], "status" : "OK" } "

[Geocoding] Add XML parser

The Geocoder provider only supports the JSON format. As Google Map supports the XML one, we should support it too.

Setting bounds ignores first coordinate

When I set the bounds for the map like this:

        $map = $this->get('ivory_google_map.map');
        $map->setAutoZoom(true);
        $map->setBound(new Coordinate(48.5, 12.1), new Coordinate(51.1, 18.9));

and output it in twig with

        {{ google_map_container(map) }}
        {{ google_map_js(map) }}

in the JavaScript output is e.g.

map_524188a66f2a3_container.coordinates.coordinate_524188a66fa73 = coordinate_524188a66fa73 = new google.maps.LatLng(48.5, 12.1, true);
map_524188a66f2a3_container.coordinates.coordinate_524188a66fa73 = coordinate_524188a66fa73 = new google.maps.LatLng(51.1, 18.9, true);
map_524188a66f2a3_container.bounds.bound_524188a66f2a3 = bound_524188a66f2a3 = new google.maps.LatLngBounds(coordinate_524188a66fa73, coordinate_524188a66fa73);
map_524188a66f2a3_container.map = map_524188a66f2a3 = new google.maps.Map(document.getElementById("map_canvas"), {"mapTypeId":google.maps.MapTypeId.ROADMAP});
map_524188a66f2a3.fitBounds(bound_524188a66f2a3);

i.e. both coordinates are named the same, which results in a bound that takes only the second (northeast) coordinate into account.

Is that a bug or I'm not following the docs right? Thanks!


EDIT:
I've actually noticed a very similar thing happens when adding multiple Markers. I had to give every coordinate and every marker a special JS prefix - is that a standard way to do it??

Introduce HelperManager

The Map object becomes to large imho. All helpers are composed 1 on 1 which doesn't seem very flexible if a new helper is added.

How about $map->getHelper('marker') or $map->getHelperManager()->get('marker')?

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.