Disable scaling/increasing Polyline when zoom out/in the map - android

My app draws your route by adding Polylines. The user sets color, width and transparent. The only problem is that I dont want to change the size of polylines but when I zoom out or zoom in map then polyline's size change.
Anyone know how to disable that "size changing" function?

You can use
yourPolyLine.setWidth(yourIntegerValue)
For more detail of in google maps you can refer this link.
For to not scaling polyline in map when user zoom in/out, you have to set polyline width. To do this you can refer this link.

Related

Draw an inverted circle on google map with specific radius android

I want to develop below picture in android, which is already implemented in iOS.
I know how to add circle on google map. but as shown in picture the color should be filled on map not on the circle, circle must be fully transparent.
i have referred many links but all of that put the simple overlay on map, so when user zoom in or zoom out the map; circle remains the same.
i have implemented simple circle around current location.
googleMap.addCircle(new CircleOptions()
.center(new LatLng(MyApplication.latitude, MyApplication.longitude))
.radius(800)
.fillColor(0x70ffffff))
.setStrokeWidth(0);
i want above functionality with inverse color. circle should be only around current location and the size should vary with zoom in and zoom out of map.
Thanks.

Android calculate bounding box for mapview

I am not using Google maps or Openstreet maps. I am using another third party custom maps which do not provide any bounding box classes or methods. So What i want to achieve is to zoom to fit all markers on the map or zoom to route drawn on map. Like Google provide LatLngBounds bounds = mMap.getProjection().getVisibleRegion().latLngBounds; classes and OpenStreetMaps provides zoomToBoundingBox() to achieve this functionality. I only have latlng points and map dimensions width/height. How can i calculate bounds or bounding box zoom level for markers or route drawn on map to fit it to screen? Any formula or mathematical calculations?

Adding markers to google map 2 depending on the zoom level

I have multiple markers set around on the map. What I want to know is how can I show only a few markers depending on the zoom level. For example: I have a zoom on the map with radius: the length between the center of the map and the bounds of the screen (lets say this is like 2km in real life not sure if this is true) so I want to show only the markers that are inside the radius. And of course if the user zooms out the radius will be recalculated again from the center point of the map to the bound of the screen. And again include markers that are inside the new radius. How can I achieve this?
I have thought about this problem and here could be an approach.
you can loop through your available markers and find distance from the center of your given circle (since we're talking about a radius) to the marker; this can be done using computeDistanceBetween(); for more info see link
If the marker lies within your radius, show, otherwise, hide using the setVisible() method. For more information, see link
Hope this gives you some idea.

Android maps - Markers Bounds at the center of top half of map area

I have Android Map Extension attached under actionBar.
I have couple of markers, lets say 2000.
Than I have ArrayList of selected 3 markers upon some constant condition, nevermind.
I want to zoom and move map to include this selected 3 markers at max possible zoom.
It's an easy task, from this forum I found an easy way to do it :
LatLngBounds bounds = new LatLngBounds.Builder().include(new LatLng(maxLat, maxLon)).include(new LatLng(minLat, minLon)).build();
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0));
I have map perfectly zoomed at this 3 markers.
Now is hard part.
When I zoom at this markers I have layout that covers bottom half of map.
I want to archive the same situation but on upper half of map only.
Resizing map is not an option.
I've tried to enlarge my boundaries 2 times vertically but it doesn't help
Thank you for your help in advance
GoogleMap.setPadding is what you need. Simply set bottom to half of the height of your map.

Android-Adjusting the zoom controls

In my google maps activity,the map is shown based on the current position.So i need to adjust the zoom controls of the map so that my current point and target point is always visible in the map.I think i need to be more specific.ie,I have a target address that is shown by an overlay image.My current position is focused on the map.So as I move away from the target,I need to adjust the zoom controls so that the target is still visible.Similarly,When I move close to target,I need to zoom in.
Check this answer here they have given code to zoom to the level to show each Overlay Marker drawn on the map so each of them are visible..may be this can solve your problem
LINK TO THE QUESTION
Use the following methods of MapView:
mapView.getController().setZoom(13); // set the zoom level here
mapView.getController().setCenter(point);
where mapview is the instance of MapView.
Hope this is what you want.

Categories

Resources