ios - GMSMapView GroundOverlay Cover Entire MapView Bounds -


i have setup uiview display specific region of map using google maps. want add image overlay on top of selected region dont know how calculate correct coordinates this. have set map center coordinate, overlay needs northwest , south east coordinates. can please? trying put image of race track on roads.

below code far:

- (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib.      gmscameraposition *camera = [gmscameraposition camerawithlatitude:14.5809268                                                        longitude:120.975319                                                             zoom:16.5                                                          bearing:90                                                     viewingangle:0];      // indicating map frame bounds     mapview_ = [gmsmapview mapwithframe:self.mapviewonscreen.bounds camera: camera];     mapview_.mylocationenabled = yes;      // add subview mapview     [self.mapviewonscreen addsubview: mapview_];       //this need figure out coordinates stuck...      cllocationcoordinate2d southwest = cllocationcoordinate2dmake(40.712216,-74.22655);     cllocationcoordinate2d northeast = cllocationcoordinate2dmake(40.773941,-74.12544);     gmscoordinatebounds *overlaybounds = [[gmscoordinatebounds alloc] initwithcoordinate:southwest                                                                           coordinate:northeast];       //add track image on road map show race track - roads need match      uiimage *icon = [uiimage imagenamed:@"track.jpg"];     gmsgroundoverlay *overlay =     [gmsgroundoverlay groundoverlaywithbounds:overlaybounds icon:icon];     overlay.bearing = 0;     overlay.map = mapview_;      // creates marker in center of map.     gmsmarker *marker = [[gmsmarker alloc] init];     marker.position = cllocationcoordinate2dmake(14.5809268, 120.975319);     marker.title = @"race day";     marker.snippet = @"manila";     marker.map = mapview_;  } 

i haven't tried this, after doing research on api, think can achieve want doing following:

gmsprojection *projection = mapview_.projection; gmsvisibleregion visibleregion = [projection visibleregion]; gmscoordinatebounds *coordinatebounds = [[gmscoordinatebounds alloc] initwithregion:visibleregion]; cllocationcoordinate2d northeast = coordinatebounds.northeast; cllocationcoordinate2d southwest = coordinatebounds.southwest; 

hope helps.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -