Git Product home page Git Product logo

googlemap-1's Introduction

GoogleMap

Get Current Location, Location Search API, add custom pin so on.

Show Map and Location

@property (strong, nonatomic) IBOutlet GMSMapView *mapContainerView;

//GoogleMap Settings
self.mapContainerView.myLocationEnabled = YES;
self.mapContainerView.settings.myLocationButton = YES;
self.mapContainerView.settings.allowScrollGesturesDuringRotateOrZoom = YES;
self.mapContainerView.settings.compassButton = YES;
self.mapContainerView.mapType = kGMSTypeTerrain;

GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:currentLocation.coordinate.latitude
                                                            longitude:currentLocation.coordinate.longitude
                                                                 zoom:16];
self.mapContainerView.camera = camera;

GMSMarker *marker = [[GMSMarker alloc] init];
marker.position = CLLocationCoordinate2DMake(currentLocation.coordinate.latitude, currentLocation.coordinate.longitude);
marker.title = @"Current Location";
marker.snippet = @"Current Location";
marker.map = self.mapContainerView;

GoogleMap Delegate

Mehods for GoogleMap location update and finished.

  • GMSMapViewDelegate GoogleMap delegate should be required.
- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position
{
    double latitude = mapView.camera.target.latitude;
    double longitude = mapView.camera.target.longitude;
    
    NSLog(@"LAT:%f LONG:%f",latitude,longitude);
    
//    CLLocationCoordinate2D center = CLLocationCoordinate2DMake(latitude, longitude);
}

- (void)mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position
{
    double latitude = mapView.camera.target.latitude;
    double longitude = mapView.camera.target.longitude;
    
    [self CallLocationGetAddress:latitude Long:longitude];
    NSLog(@"Complited LAT:%f LONG:%f",latitude,longitude);
}

GoogleMap URL

  • Send Latitude and Longitude to get full address of location.
[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/geocode/json?latlng=%f,%f&key=%@",Lat,Long,GOOGLE_API_KEY]
  • GoogleMap Search API.
[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/autocomplete/json?key=%@&input=%@",GOOGLE_API_KEY,strValue]
  • Send PlaceID to get location of latitude and longitude.
[NSString stringWithFormat:@"https://maps.googleapis.com/maps/api/place/details/json?placeid=%@&key=%@",strPlaceID,GOOGLE_API_KEY]

googlemap-1's People

Contributors

ravi-dhorajiya avatar

Stargazers

MohsinAli avatar

Watchers

MohsinAli avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.