Show circle around selected location - ios

As we have seen there is a circle around current location in iOS mkmapview. Is there any way to draw a similar circle in mkmapview for location other then current location?

If you look at the documentations for MKCircle: http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKCircle_class/Reference/Reference.html and MKCircleView: http://developer.apple.com/library/iOS/documentation/MapKit/Reference/MKCircleView_class/Reference/Reference.html both of which are part of the MapKit API,
you'll find tools for drawing circles!
As mentioned at this link Circle around a point on an MKMapView
there are no easy way to create animations for these circles, however the advantage is that they will provide you with a degree of accuracy for your coordinates on your map!
The steps to creating the circles, one way, is here: Drawing a circle on mapkit
Basically, create an MKCircle object using circleWithCenterCoordinate:radius: method and add it to your mapView (using addOverlay: method)
Next, in the mapView delegate, implement mapView:viewForOverlay: method, create and setup MKCircleView instance there and return it.

Related

iOS MapKit - drawing shapes on map

I'd like to allow users to mark some area on map. This area should be any closed shape. For instance user can draw something like this:
In next step I'd like to calculate region of this shape. How can I achive this?
You can use MKPolygon.
First of all you'll need to disable user interaction on the map view so that it won't move around while you're trying to draw on it. Next up you can use the UIResponder functions touchesBegan, touchesMoved and touchesEnded. As you move through these three functions you can record the points the user has pressed. Lastly you can then create an MKPolygon from this array of points that you have recorded.

How to draw Polygon using multiple coordinate (Without using MKPolygon) and check if current location is in Polygon in Swift 3

I want to draw Polygon using n number of coordinate (But don't want to use MKPolygon bcz I don't have any Map view just doing all this programmatically). And also want to check if my current location is in Polygon. I want this to be done in Swift 3.
Thanks!
UIBezierPath will draw simple polygons (among other shapes), and has a convenient contains() function to check wether a point is inside the area of the path.
https://developer.apple.com/documentation/uikit/uibezierpath?changes=latest_minor

Can we add the custom view or the pulse ring animation around the marker in google maps

I have to add a pulse ring animation around a marker. As I see there is only NSObject in GOOGLEMAPS so we cannot add up a view . I have also tried to change or animate the scale of the marker but the scale change did not happen. Can anybody help me with this thing?
I've worked quite a bit with clustering markers with Google Maps for iOS SDK. GMSMapView uses OpenGL to render the markers on the map corresponding to the data points added via GMSMarkers. They provide a basic pop animation on appearance, but nothing else.
Without tracking GMSMarker movements and adding/keeping track of your own UIViews on the GMSMapView, this doesn't seem possible. GMSMarker lets the user specify a UIImage to replace the default marker image, but not animate the rendered UIImage, as the GMSMapView is backed by OpenGL. It is quite limiting- clustering markers was difficult because you cannot replace the default GMSMarker image with just a UIView. It HAS to be a UIImage.

Round selection of location on the MKMapView

I want to implement a circular selection (with center and radius) on the MKMapView like it looks on the screenshot below.
Should be possible to move the selection pulling the green pointer and change circle radius pulling the dark gray pointer.
What the best way to implement it? Maybe there's already some solution?
I would be grateful for any help.
I have not found ready-made solution for select circular map region from MKMapView. So I created own component to do that. https://github.com/d0ping/DBMapSelectorViewController
You can add a UISlider to your map and update MKCircle radius on the Value Changed action.
Please take a look how to use MKCircle here - How to create MKCircle in Swift?

MapKit uber style map Center annotation

I would like to have a annotation in the center of the map, that does not move when the region is changed. That is, when one moves the map, the annotation stays in the center regardless. I have implemented this using NStimer, assigning the map center coordinate to the annotation every .001 seconds, however this is very choppy and doesn't look smooth.
I realize that I need to use an Overlay than convert the overlay annotation to coordinates on the map.
Pretty much it would look like what Uber has.
THe other solutions for this that I have seen have not used a normal annotation. Instead they put another view over the top of the map with the annotation image in the middle. It doesn't matter what happens to the map the view stays centered on the screen and if you do ever need to interact with it, you just ask the map what the center coordinate is at that time.
You can get the code from the following link:
https://github.com/scottrhoyt/CenterPinMapViewController

Resources