how to drag map to four main directions in ionic 2? - google-maps-api-3

In app which is using google map js v3 I want to make a function that when tapping around the maker then map was opposite of dragging to that direction, for example 10 meters dragging to left when tapping to right.

in my case by adding value to the lat lng and map.setCenter() method moving map under marker

Related

How to set a LocationRectangle on Universal Windows Platform map control?

I am developing an app in which I have a Map control! On this map, I am adding custom pushpins via map.Children property. How can I set a LocationRectangle and then zoom on it? Because I want my pushpins not to be out of the screen size. I want the map to zoom on a level in which all of the pins will be on the screen!
You can use the MapControl's TrySetViewBoundsAsync method. This method allows you to specify a bounding box of the area you want to display (which you can calculate by finding the the farthest pushpins in all directions, which will give you the north-west and south-east corner of the area), a potential margin and a map animation to use while the view is being changed.
You can find more details about the method in the documentation.

Here sdk navigation direction arrows are below Z-Index 0

I'm drawing some MapPolyline on the map and then using the map for navigation. Sadly, the arrows showing the direction to take at the next turn is bellow the MapPolyline. I have set the ZIndex of the polyline to 0 but it does not solve the issue.
How to have the direction arrow above the MapPolyline?
Snapshot of the issue:
You can try using MapObject#setOverlayType(MapOverlayType). Note that this must be called on the MapPolyline before it is added to a Map. More info here: Map Rendering Order

Update the coordinates and center map to marker

I have a Google Maps JavaScript v3 map on my website that allows me to drag the marker to get the coordinates for the given location. This works perfectly but I also want to enter the coordinates manually and then click on a link to update the marker. This works great but I can't center the map to the marker (make it to pan to the marker).
I have also added a select box with solid coordinates to quickly get to a specific location on the map. I have the same problem for this one to as for the first problem.
The problem is that when I manually enter the coordinates or choose a fixed location, the marker only moves few steps from the origin position or it doesn't move at all. When you try to grab the marker and move it you can't move it and the X is far away from the marker. After few attempts to move the marker the maps goes blank but the marker stands still.
You can see my solution and problems on jsFiddle. How can I fix my issue?
Thanks in advance.
function moveMarker() {
var lat = parseFloat(document.getElementById('marker-latitude').value);
var lng = parseFloat(document.getElementById('marker-longitude').value);
var newLatLng = new google.maps.LatLng(lat, lng);
marker.setPosition(newLatLng);
map.setCenter(newLatLng);
}
Does that work?

Calculate number of markers in visible area of Google Maps

I have, for example, 10 markers on Google Map. But I zoomed and in visible area left only 2 markers.
Can Google Maps API somehow return me a number of markers in visible area (2 for my example)?
You can evaluate map.getBounds().contains(marker.getPosition()) with each marker to see which ones are included in the current viewport.
The above code is not working. There is no method as such getBounds(). Below is the updated code :
VisibleRegion visibleRegion = map.getProjection().getVisibleRegion();
LatLngBounds mapBound = visibleRegion.latLngBounds;
if(mapBound.contains(marker.getPosition()){
// do somethings i.e. such as changing marker icon and others.
}

Is there a helper function / formula to keep the circle overlay constant while zoom in/out within Google Map?

I'm using GMap V3 API Circle to display the event location, if the more events occurs in that location, the size of the circle, i.e the radius would be bigger, in other words, the size of circle only relates to the event number occur in that location.
However, the radius of circle API is in meters on the Earth Surface, which means if I zoom in/out, the visual size of circle varies, so is there some function or formula to keep the circle size constant no matter which zoom level I'm in?
Thank you!
Ryan
I haven't seen any function to make the constant circle overlay on Google map. So the alternative solution which I am using that I have make the image of circle and then use the marker overlay with custom image on Google map. Following is the code of marker overlay.
var image = 'circle.png';
var beachMarker = new google.maps.Marker({
position: centerPoint,
map: map,
icon: image,
});

Resources