Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular-google-map bounds example

failed to figure out how to do it. I have a bunch of markers and I manually calculated the northeast and southwest points. but it looks there is no effect; ( looking forward an example how to use the bounds. Thanks.

html:

<google-map center="map.center" zoom="map.zoom" pan="true" draggable="true" bounds="maps.bounds"> 

js:

$scope.map = {
        // http://angular-google-maps.org/use
        center: {
            latitude: 34.04858,
            longitude: -84.29431
        },
        zoom: 16,
        lineStyle: {
            color: '#333',
            weight: 5,
            opacity: 0.7
        },
        bounds:{}

    };    
// in another call...............
$scope.map.bounds={
                          northeast : northeast,
                          southwest: southwest
                        }
  $scope.$apply();
like image 526
Vincent Zhou Avatar asked Aug 20 '14 21:08

Vincent Zhou


People also ask

How do you get bounds on Google Maps?

getBounds() in Google Maps API v3 But in API v3 you will get “bounds is undefined” error. So to get our latitude and longitude we need to move getBounds(), to some event listener. Description of bounds_changed in documentation is: “This event is fired when the viewport bounds have changed.”

Does Google Maps use angular?

The new Angular Component pearl-lullaby (v9. 0.0-rc. 0) introduces the second official @angular/component component, a Google Maps component.

How do I show only one country on Google Maps?

Search for "kml {country/city/state/region name}" in google and you'll probably find all that data with the border outline points. Note that for the square you got 5 points, that is because you have to connect to the first point. "[[-147, 2], [-150, 70], [-20, 68], [-31, 5], [-147, 2]]".


1 Answers

I think that the problem may be the zoom. Logically speaking the zoom concept is not gets along with bounds, because the bounds define a zoom.

like image 119
hayatoShingu Avatar answered Sep 30 '22 14:09

hayatoShingu