7

How to zoom mapview within 5 miles of the current location

 2 years ago
source link: https://www.codesd.com/item/how-to-zoom-mapview-within-5-miles-of-the-current-location.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

How to zoom mapview within 5 miles of the current location

advertisements

I know its a very common issue but I am not getting the exact answer for this thing.

How to make MKMapView defaults to a zoom of a 5 mile radius of current location.

Thanks in advance.


Use the following code when ever you want to zoom to 5 miles radius:

double miles = 5.0;
double scalingFactor = ABS( (cos(2 * M_PI * newLocation.coordinate.latitude / 360.0) ));

MKCoordinateSpan span; 

span.latitudeDelta = miles/69.0;
span.longitudeDelta = miles/(scalingFactor * 69.0); 

MKCoordinateRegion region;
region.span = span;
region.center = newLocation.coordinate;

[mapView setRegion:region animated:YES];

Related Articles

How to load sites on json map (lat and; long) of json within 5 miles of the current location

I have a fragment with loads all the shops locations on the google maps. But now I want to load only the shops within 5 miles from current location. This is my code: public class NearMeFragment extends Fragment implements GooglePlayServicesClient.Con

Grails: How do I get an i18 message using the current location?

I'm coding in Grails (2.2.4) + groovy application, and I need to get i18 message, what are the possible ways to return this kind of value?Check the official documentation - http://grails.org/doc/2.2.x/guide/i18n.html You can find there all interestin

How can I have the latitude and longitude of the current location in Blackberry?

I am developing an app which has GPS functionality. How can I get latitude and longitude of the current location.I found a solution by myself. The following code works fine for me: package mypackage; import javax.microedition.location.Location; impor

Zooming to the current location does not work with the navigation drawer

I'm developing an Android Application which is consists of a Navigation drawer and a Google Map. I have successfully developed my Navigation Drawer and connect my Map into it. The thing is I need my Map to Zoom to the current location. Here is the co

Mkmapview will automatically zoom in to the current location of the user when you try to zoom in to other locations

He is desperately waiting for the solution... I am displaying the current user location and some custom annotations, but, when I am trying to zoom in into the map my map automatically redirecting to the current location with default zoom that is beca

How do I find the current location of an item in the browser?

I was wondering how we would be able to find the current location of the element in the browser. I am trying to create a jQuery slider. Have created sliders by animating margins earlier. But this case is bit complicated. It has two navigations. one t

How to select all 10-minute records in the current timestamp in MySQL?

I have timestamps in a table column called "last_seen" like so: 2012-01-25 18:46:42 2012-01-23 08:19:04 2012-01-23 08:19:04 etc... How can I get all records where the timestamp is within 10 minutes of the current timestamp (in the most efficient

How to find the nearest 100 meters latitude and longitude depending on the current location in the lens c, Iphone

How to find the nearest 100 meters latitude and longitude depending upon the current location, i have created a database in SQLITE3 which consists of set of latitudes and longitudes and corresponding there location name. Depending upon the current lo

Unable to zoom the fragment of the Android card to the current location

This is not the first question im posting regarding this matter in Stack Overflow. I really need help to zoom my map fragment to the current location. Please don't think I'm not trying anything. I tried a lot. I need to zoom my map to the current loc

iOS MapView displays the current location and annotation in the visibleRect

I have a little problem. I just want to show the current user location at the center of the mapview. And the mapview zoom to the region that can show the annotation and the user location at the same time. The showAnnotation func of mapview seems to h

How can I send the current location from one activity to another?

I am using map to get current location and now I want to send my current location to another activity which has form to input all the data. I am confused about which variables and methods I should use to send the location data. ChooseFromMapActivity

How to find the current location in iPhone?

I have written the following code to find the current location. It works well and prints the current location when I print lat2 and logg2 below in NSLOg, but it is not assigning value to lables. When I print label the value is null. And I want to acc

How to have Visual Studio request the source path after I receive: & ldquo; There is no source code available for the current location. & Rdquo;

Sometimes, in debugging mode, I try to watch code at some level of the call stack, and I get an error: There is no source code available for the current location. I know what it means. If I know where the file is, how can I give the source file to Vi

Using Google Maps API, how can we set the current location as the default location using the map.setCenter function?

I am writing JavaScript code using Google Maps API. map = new google.maps.Map2(document.getElementById("map_canvas")); map.setCenter(new google.maps.LatLng(37.4419, -122.1419), 13); The above code sets the default location of the map canvas to P

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK