\nCLLocation* locSouthWest = [[CLLocation alloc] initWithLatitude: min.latitude longitude: min.longitude];\nCLLocation* locSouthEast = [[CLLocation alloc] initWithLatitude: min.latitude longitude: max.longitude];\nCLLocation* locNorthEast = [[CLLocation alloc] initWithLatitude: max.latitude longitude: max.longitude];\nCLLocationCoordinate2D regionCenter;\nregionCenter.latitude = (min.latitude + max.latitude) / 2.0;\nregionCenter.longitude = (min.longitude + max.longitude) / 2.0;\u003Cbr/>\nCLLocationDistance latMeters = [locSouthEast getDistanceFrom: locNorthEast];\nCLLocationDistance lonMeters = [locSouthEast getDistanceFrom: locSouthWest];\nMKCoordinateRegion region;\nregion = MKCoordinateRegionMakeWithDistance( regionCenter, latMeters, lonMeters );\nMKCoordinateRegion fitRegion = [self.mapView regionThatFits: region];\n[self.mapView setRegion: fitRegion animated: YES];\n[locSouthWest release];\n[locSouthEast release];\n[locNorthEast release];\n\n","objc",[45,1427,1428,1432,1437,1442,1447,1452,1457,1462,1467,1472,1477,1482,1487,1492,1497,1502,1507,1512,1517,1522,1527,1532,1537,1542,1547,1552,1557,1562,1567,1572,1578,1584,1590],{"__ignoreMap":43},[48,1429,1430],{"class":50,"line":51},[48,1431,243],{"emptyLinePlaceholder":242},[48,1433,1434],{"class":50,"line":57},[48,1435,1436],{},"if ( [[self.mapView annotations] count] \u003C 2 )\n",[48,1438,1439],{"class":50,"line":63},[48,1440,1441],{}," return;\n",[48,1443,1444],{"class":50,"line":69},[48,1445,1446],{},"CLLocationCoordinate2D min;\n",[48,1448,1449],{"class":50,"line":75},[48,1450,1451],{},"CLLocationCoordinate2D max;\n",[48,1453,1454],{"class":50,"line":81},[48,1455,1456],{},"BOOL minMaxInitialized = NO;\n",[48,1458,1459],{"class":50,"line":87},[48,1460,1461],{},"for ( id\u003CMKAnnotation> a in [self.mapView annotations] ) {\n",[48,1463,1464],{"class":50,"line":93},[48,1465,1466],{}," if ( !minMaxInitialized ) {\n",[48,1468,1469],{"class":50,"line":99},[48,1470,1471],{}," min = a.coordinate;\n",[48,1473,1474],{"class":50,"line":158},[48,1475,1476],{}," max = a.coordinate;\n",[48,1478,1479],{"class":50,"line":164},[48,1480,1481],{}," minMaxInitialized = YES;\n",[48,1483,1484],{"class":50,"line":170},[48,1485,1486],{}," } else {\n",[48,1488,1489],{"class":50,"line":176},[48,1490,1491],{}," min.latitude = MIN( min.latitude, a.coordinate.latitude );\n",[48,1493,1494],{"class":50,"line":182},[48,1495,1496],{}," min.longitude = MIN( min.longitude, a.coordinate.longitude );\n",[48,1498,1499],{"class":50,"line":407},[48,1500,1501],{}," max.latitude = MAX( max.latitude, a.coordinate.latitude );\n",[48,1503,1504],{"class":50,"line":413},[48,1505,1506],{}," max.longitude = MAX( max.longitude, a.coordinate.longitude );\n",[48,1508,1509],{"class":50,"line":419},[48,1510,1511],{}," }\n",[48,1513,1514],{"class":50,"line":424},[48,1515,1516],{},"}\u003Cbr/>\n",[48,1518,1519],{"class":50,"line":430},[48,1520,1521],{},"CLLocation* locSouthWest = [[CLLocation alloc] initWithLatitude: min.latitude longitude: min.longitude];\n",[48,1523,1524],{"class":50,"line":436},[48,1525,1526],{},"CLLocation* locSouthEast = [[CLLocation alloc] initWithLatitude: min.latitude longitude: max.longitude];\n",[48,1528,1529],{"class":50,"line":442},[48,1530,1531],{},"CLLocation* locNorthEast = [[CLLocation alloc] initWithLatitude: max.latitude longitude: max.longitude];\n",[48,1533,1534],{"class":50,"line":448},[48,1535,1536],{},"CLLocationCoordinate2D regionCenter;\n",[48,1538,1539],{"class":50,"line":454},[48,1540,1541],{},"regionCenter.latitude = (min.latitude + max.latitude) / 2.0;\n",[48,1543,1544],{"class":50,"line":460},[48,1545,1546],{},"regionCenter.longitude = (min.longitude + max.longitude) / 2.0;\u003Cbr/>\n",[48,1548,1549],{"class":50,"line":465},[48,1550,1551],{},"CLLocationDistance latMeters = [locSouthEast getDistanceFrom: locNorthEast];\n",[48,1553,1554],{"class":50,"line":471},[48,1555,1556],{},"CLLocationDistance lonMeters = [locSouthEast getDistanceFrom: locSouthWest];\n",[48,1558,1559],{"class":50,"line":477},[48,1560,1561],{},"MKCoordinateRegion region;\n",[48,1563,1564],{"class":50,"line":1154},[48,1565,1566],{},"region = MKCoordinateRegionMakeWithDistance( regionCenter, latMeters, lonMeters );\n",[48,1568,1569],{"class":50,"line":1160},[48,1570,1571],{},"MKCoordinateRegion fitRegion = [self.mapView regionThatFits: region];\n",[48,1573,1575],{"class":50,"line":1574},30,[48,1576,1577],{},"[self.mapView setRegion: fitRegion animated: YES];\n",[48,1579,1581],{"class":50,"line":1580},31,[48,1582,1583],{},"[locSouthWest release];\n",[48,1585,1587],{"class":50,"line":1586},32,[48,1588,1589],{},"[locSouthEast release];\n",[48,1591,1593],{"class":50,"line":1592},33,[48,1594,1595],{},"[locNorthEast release];\n",[18,1597,1598],{},"The code might look complicated, but we can break it down into 3 steps:",[1600,1601,1602],"ol",{},[1603,1604,1605],"li",{},"Iterate over all our custom annotations (we only have one) to determine the max/min latitude and longitude",[1607,1608,1609,1624],"ul",{},[1603,1610,1611,1612,1615,1616,1619,1620,1623],{},"This results in a triangle ",[1408,1613,1614],{},"locSouthWest",", ",[1408,1617,1618],{},"locSouthEast"," and ",[1408,1621,1622],{},"locNorthEast",", that we can use to determine the center\nfor our zoom",[1603,1625,1626,1627,1630],{},"Using the distance between the triangle points and the center, we can fit the map into a ",[1408,1628,1629],{},"MKCoordinateRegion",", that\nwill zoom it so that everything fits on the screen.",[18,1632,1633,1634,1637],{},"One thing this algorithm doesn’t include, is the ",[1408,1635,1636],{},"AnnotationView"," that display the name and location of the red pin. It\nsometimes happens, that it’s displayed outside of the screen, once you tap on the pin. However, if you add the code\nabove and hook it into the following method:",[38,1639,1641],{"className":1423,"code":1640,"language":1425,"meta":43,"style":43},"\n- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views\n\n",[45,1642,1643,1647],{"__ignoreMap":43},[48,1644,1645],{"class":50,"line":51},[48,1646,243],{"emptyLinePlaceholder":242},[48,1648,1649],{"class":50,"line":57},[48,1650,1651],{},"- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views\n",[18,1653,1654,1655,1658],{},"You still need to add the code, which handles the annotation, but you can feel free to steal it\nfrom ",[22,1656,1390],{"href":1388,"rel":1657},[26],". The result should look something\nlike this:",[18,1660,1661],{},[1339,1662],{"alt":1399,"src":1663},"https://media.synyx.de/uploads//2010/05/screen_synyx_map.png",[18,1665,1666,1667,1670],{},"This concludes our little tutorial on Google Maps and ",[1408,1668,1669],{},"MapKit",". I hope it was helpful! If you need any assistance, just\nleave a comment or drop me an email, I’ll be happy to help you out.",[673,1672,675],{},{"title":43,"searchDepth":57,"depth":57,"links":1674},[],[682,683],"2010-05-19T06:44:08","In\\nmy first installment,\\nwe laid the foundation for todays blog post. So don’t hesitate to head back for a recap, if you need to. You can\\ndownload the code for this tutorial on github.","https://synyx.de/blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-ii/",{},"/blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-ii",{"title":1369,"description":1682},"In\nmy first installment,\nwe laid the foundation for todays blog post. So don’t hesitate to head back for a recap, if you need to. You can\ndownload the code for this tutorial on github.","blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-ii",[1362,1685],"iphone","In my first installment, we laid the foundation for todays blog post. So don’t hesitate to head back for a recap, if you need to. You can download the code…","Hpc7jZiUS-9fX42oCKNm3kaFp-aPqLQkR6HNXUf1bUU",{"id":1689,"title":1690,"author":1691,"body":1693,"category":1852,"date":1853,"description":1854,"extension":686,"link":1855,"meta":1856,"navigation":242,"path":1857,"seo":1858,"slug":1697,"stem":1860,"tags":1861,"teaser":1863,"__hash__":1864},"blog/blog/google-maps-on-android-part-2-overlays.md","Google Maps on Android – Part 2: Overlays",[1692],"heib",{"type":11,"value":1694,"toc":1850},[1695,1698,1707,1725,1728,1731,1734,1737,1740,1743,1746,1757,1771,1774,1777,1780,1782,1789,1792,1795,1811,1814,1817,1820,1822,1828],[14,1696,1690],{"id":1697},"google-maps-on-android-part-2-overlays",[18,1699,1700,1701,1706],{},"In my ",[22,1702,1705],{"href":1703,"rel":1704},"http://mobile.synyx.de/2010/04/30/google-maps-on-android/",[26],"last post about Google Maps on Android"," I showed you\nhow to use the basic navigation features of google maps, like moving the map to a defined area and zooming to a given\nlevel.",[18,1708,1709,1710,1715,1716,1720,1721,1724],{},"Now as you have centred your map and zoomed in, it would be a good idea to show some kind of marker. Otherwise the user\nwon’t actually realize what you want to show him. How a basic overlay is done, is described in\nthe ",[22,1711,1714],{"href":1712,"rel":1713},"http://developer.android.com/resources/tutorials/views/hello-mapview.html",[26],"tutorial on the android developer site",",\nalready mentioned in the ",[22,1717,1719],{"href":1703,"rel":1718},[26],"last post",". The\n",[1408,1722,1723],{},"HelloItemizedOverlay"," that is created there, enables you to add as many markers to your map as you want:",[18,1726,1727],{},"`List mapOverlays = mapView.getOverlays();",[18,1729,1730],{},"Drawable drawable = this.getResources().getDrawable(R.drawable.synyxLogo);",[18,1732,1733],{},"HelloItemizedOverlay itemizedOverlay = new HelloItemizedOverlay(drawable);",[18,1735,1736],{},"OverlayItem synyxOfficeOverlay = new OverlayItem(synyxOfficeLocation, \"Synyx\", \"This is the Synyx office!\");",[18,1738,1739],{},"itemizedOverlay.addOverlay(synyxOfficeOverlay);",[18,1741,1742],{},"// add more overlayItems...",[18,1744,1745],{},"mapOverlays.add(itemizedOverlay);`",[18,1747,1748,1749,1752,1753,1756],{},"This will draw a nice marker just at the location of the synyx office. The drawback of this method is, that all markers\non the map just look the same. You might think: No problem – just use the ",[1408,1750,1751],{},"setMarker()"," method of the ",[1408,1754,1755],{},"OverlayItem"," to\nset a new marker for just this item. As this looks like the way to do it, it won’t work. All you get is no marker (not\nthe one you just set, nor the default one). The map is just shown as if your marker was not defined at all.",[18,1758,1759,1760,1763,1764,1767,1768,1770],{},"So how to do it? The trick is the static method ",[1408,1761,1762],{},"boundCenterBottom()"," of the ",[1408,1765,1766],{},"ItemizedOverlay"," class. This method is\nalso called in the constructor of the ",[1408,1769,1723],{},", when the default marker is set:",[18,1772,1773],{},"`public RouteMapOverlay(Drawable defaultMarker, Context context) {",[18,1775,1776],{},"super(boundCenterBottom(defaultMarker));",[18,1778,1779],{},"this.context = context;",[18,1781,1264],{},[18,1783,1784,1785,1788],{},"The problem is, that the visibility of this method is set to ",[1408,1786,1787],{},"protected"," (why?!). So calling it when setting the marker\nwon’t work:",[18,1790,1791],{},"`// won't work as boundCenterBottom is protected",[18,1793,1794],{},"synyxOfficeOverlay.setOverlay(ItemizedOverlay.boundCenterBottom(myNewMarker));`",[18,1796,1797,1798,1800,1801,1803,1804,1807,1808,1810],{},"Because of this visibility feature, the “easier” way is to add a new setter to your ",[1408,1799,1723],{}," class,\naccepting an ",[1408,1802,1755],{}," and a ",[1408,1805,1806],{},"Drawable"," to use as the marker. Within that setter, you are able to call the\n",[1408,1809,1762],{}," method to set up the marker correctly:",[18,1812,1813],{},"`public void addOverlay(OverlayItem overlayItem, Drawable marker) {",[18,1815,1816],{},"overlayItem.setMarker(boundCenterBottom(marker));",[18,1818,1819],{},"addOverlay(overlayItem);",[18,1821,1264],{},[18,1823,1824,1825,1827],{},"Now if you use that setter, the map will correctly show your ",[1408,1826,1755],{}," with your marker.",[18,1829,1830,1831,1833,1834,1836,1837,1840,1841,1844,1845,1847,1848,1391],{},"Btw: instead of calling ",[1408,1832,1762],{}," (which places the bottom centre of your ",[1408,1835,1806],{}," over the defined\n",[1408,1838,1839],{},"GeoPoint","), you can also use ",[1408,1842,1843],{},"boundCenter()"," to place the centre of your ",[1408,1846,1806],{}," over the ",[1408,1849,1839],{},{"title":43,"searchDepth":57,"depth":57,"links":1851},[],[682,683],"2010-05-07T16:52:13","In my last post about Google Maps on Android I showed you\\nhow to use the basic navigation features of google maps, like moving the map to a defined area and zooming to a given\\nlevel.","https://synyx.de/blog/google-maps-on-android-part-2-overlays/",{},"/blog/google-maps-on-android-part-2-overlays",{"title":1690,"description":1859},"In my last post about Google Maps on Android I showed you\nhow to use the basic navigation features of google maps, like moving the map to a defined area and zooming to a given\nlevel.","blog/google-maps-on-android-part-2-overlays",[694,1362,1862,697],"marker","In my last post about Google Maps on Android I showed you how to use the basic navigation features of google maps, like moving the map to a defined area…","GBZ-bHS5o5wBdJ9oZTRvsybQjazx-suQybxkfoerVPM",{"id":1866,"title":1867,"author":1868,"body":1869,"category":2071,"date":2072,"description":2073,"extension":686,"link":2074,"meta":2075,"navigation":242,"path":2076,"seo":2077,"slug":1873,"stem":2079,"tags":2080,"teaser":2081,"__hash__":2082},"blog/blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-i.md","How to add a 'Find Your Company' feature to your iPhone App – Part I",[1371],{"type":11,"value":1870,"toc":2069},[1871,1875,1887,1894,1904,1907,1915,1931,1943,1996,2011,2045,2064,2067],[14,1872,1874],{"id":1873},"how-to-add-a-find-your-company-feature-to-your-iphone-app-part-i","How to add a \"Find Your Company\" feature to your iPhone App – Part I",[18,1876,1877,1878,1880,1881,1886],{},"We wanted to give our users the possibility to find our office. On the iPhone, the simplest way to do it, is to use\nGoogle Maps and the ",[1408,1879,1669],{}," framework. I won’t go into the details of MapKit here, since Apple’s documentation is\nawesome and they provide a lot\nof ",[22,1882,1885],{"href":1883,"rel":1884},"http://developer.apple.com/iphone/library/samplecode/CurrentAddress/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009469",[26],"sample code",",\nwhich gets you up and running in no time.",[18,1888,1889,1890,1893],{},"What I’d like to show you today, is some code, which nicely zooms the Map to your office and current location of the App\nuser, once the ",[1408,1891,1892],{},"MapView"," is loaded. Here are a couple of screenshots to give you an idea of what I’m talking about:",[18,1895,1896,1898,1899,1903],{},[1339,1897],{"alt":1399,"src":1663}," ",[1339,1900],{"alt":1901,"src":1902},"\"Synyx Routing\"","https://media.synyx.de/uploads//2010/05/screen_synyx_map_1.png","\nAs you can see, Synyx moved their offices to San Francisco. The iPhone App user, with the blue dot, is currently in\ncupertino. If he taps on the white/blue arrow in the annotation of the red dot, he is asked whether he’d really want to\nleave the App and start Google Maps to route from his current location to the Synyx Offices in San Francisco.",[18,1905,1906],{},"Now, the main focus on this blog post is how to get you using this in your App. I’m gonna split this little tutorial in\n2 parts:",[1600,1908,1909,1912],{},[1603,1910,1911],{},"Showing the Synyx Offices on the Map",[1603,1913,1914],{},"Zooming in, so that everything fits on the screen",[18,1916,1917,1918,1920,1921,1924,1925,1930],{},"If you feel like going off on your own, the code for the ",[1408,1919,1419],{}," used, is available for download\non ",[22,1922,1390],{"href":1388,"rel":1923},[26],". The zooming algorithm is borrowed\nfrom ",[22,1926,1929],{"href":1927,"rel":1928},"http://stackoverflow.com/questions/1303265/algorithm-for-determining-minimum-bounding-rectangle-for-collection-of-lat-lon-co/1413264#1413264",[26],"stackoverflow",".\nHowever, the code is one of my first iPhone projects and not polished, so don’t use it blindly. There are a couple of\nissue, e.g. I’m pretty sure it won’t survive a memory warning. It’s meant for demonstration solely!",[18,1932,1933,1934,1936,1937,1939,1940,1942],{},"So let’s get into it. We first need a ",[1408,1935,1419],{}," with a ",[1408,1938,1892],{}," associated. It is pretty straightforward and\nyou should have no problems doing that in Interface Builder. The next thing you need and that is missing from the code\non github is a custom ",[1408,1941,1669],{}," annotation:",[38,1944,1946],{"className":1423,"code":1945,"language":1425,"meta":43,"style":43},"\n@interface AddressAnnotation : NSObject\u003CMKAnnotation> {\n CLLocationCoordinate2D coordinate;\n NSString *title;\n NSString *subtitle;\n}\n- (id)initWith:(CLLocationCoordinate2D)_coords;\n@property(retain,nonatomic) NSString *title;\n@property(retain,nonatomic) NSString *subtitle;\n@end\n\n",[45,1947,1948,1952,1957,1962,1967,1972,1976,1981,1986,1991],{"__ignoreMap":43},[48,1949,1950],{"class":50,"line":51},[48,1951,243],{"emptyLinePlaceholder":242},[48,1953,1954],{"class":50,"line":57},[48,1955,1956],{},"@interface AddressAnnotation : NSObject\u003CMKAnnotation> {\n",[48,1958,1959],{"class":50,"line":63},[48,1960,1961],{}," CLLocationCoordinate2D coordinate;\n",[48,1963,1964],{"class":50,"line":69},[48,1965,1966],{}," NSString *title;\n",[48,1968,1969],{"class":50,"line":75},[48,1970,1971],{}," NSString *subtitle;\n",[48,1973,1974],{"class":50,"line":81},[48,1975,185],{},[48,1977,1978],{"class":50,"line":87},[48,1979,1980],{},"- (id)initWith:(CLLocationCoordinate2D)_coords;\n",[48,1982,1983],{"class":50,"line":93},[48,1984,1985],{},"@property(retain,nonatomic) NSString *title;\n",[48,1987,1988],{"class":50,"line":99},[48,1989,1990],{},"@property(retain,nonatomic) NSString *subtitle;\n",[48,1992,1993],{"class":50,"line":158},[48,1994,1995],{},"@end\n",[18,1997,1998,1999,2003,2004,2007,2008,1391],{},"This will be responsible for displaying the name and city of the Synyx Offices above the red pin on the map. But it’s\nonly responsible for displaying the information, it doesn’t know where yet. In order to find the location of our offices\nusing the Google Maps API, I came up with a little helper method\ncalled ",[22,2000,2002],{"href":1388,"rel":2001},[26],"synyxLocation (line 175)",". It simply\nreturns the ",[1408,2005,2006],{},"CLLocationCoordinate2D"," struct, which is needed in our ",[1408,2009,2010],{},"AddressAnnotation",[38,2012,2014],{"className":1423,"code":2013,"language":1425,"meta":43,"style":43},"\nCLLocationCoordinate2D location = [self synyxLocation];\nself.synyx = [[AddressAnnotation alloc] initWith:location];\n[self.synyx setTitle:@\"Synyx GmbH & Co. KG\"];\n[self.synyx setSubtitle:synyxLoc];\n[mapView addAnnotation:synyx];\n\n",[45,2015,2016,2020,2025,2030,2035,2040],{"__ignoreMap":43},[48,2017,2018],{"class":50,"line":51},[48,2019,243],{"emptyLinePlaceholder":242},[48,2021,2022],{"class":50,"line":57},[48,2023,2024],{},"CLLocationCoordinate2D location = [self synyxLocation];\n",[48,2026,2027],{"class":50,"line":63},[48,2028,2029],{},"self.synyx = [[AddressAnnotation alloc] initWith:location];\n",[48,2031,2032],{"class":50,"line":69},[48,2033,2034],{},"[self.synyx setTitle:@\"Synyx GmbH & Co. KG\"];\n",[48,2036,2037],{"class":50,"line":75},[48,2038,2039],{},"[self.synyx setSubtitle:synyxLoc];\n",[48,2041,2042],{"class":50,"line":81},[48,2043,2044],{},"[mapView addAnnotation:synyx];\n",[18,2046,2047,2048,2050,2051,2053,2054,1763,2057,2059,2060,2063],{},"Instantiating the ",[1408,2049,2010],{}," with the previously determined location and adding it to the ",[1408,2052,1892],{}," will to the\nrest. I did this in the ",[1408,2055,2056],{},"viewDidLoad",[1408,2058,1419],{},", which is not be the best place. Maybe the\n",[1408,2061,2062],{},"viewWillAppear"," method would have been better.",[18,2065,2066],{},"After adding those parts discussed above, you can fire up the Simulator and get the location of our offices with a red\npin and your current location (in the Simulator it’s always Cupertino). The map doesn’t zoom yet and is not properly\nlocated, we leave that to our next installment.",[673,2068,675],{},{"title":43,"searchDepth":57,"depth":57,"links":2070},[],[682,683],"2010-05-06T09:19:07","We wanted to give our users the possibility to find our office. On the iPhone, the simplest way to do it, is to use\\nGoogle Maps and the MapKit framework. I won’t go into the details of MapKit here, since Apple’s documentation is\\nawesome and they provide a lot\\nof sample code,\\nwhich gets you up and running in no time.","https://synyx.de/blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-i/",{},"/blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-i",{"title":1867,"description":2078},"We wanted to give our users the possibility to find our office. On the iPhone, the simplest way to do it, is to use\nGoogle Maps and the MapKit framework. I won’t go into the details of MapKit here, since Apple’s documentation is\nawesome and they provide a lot\nof sample code,\nwhich gets you up and running in no time.","blog/how-to-add-a-find-your-company-feature-to-your-iphone-app-part-i",[1362,1685],"We wanted to give our users the possibility to find our office. On the iPhone, the simplest way to do it, is to use Google Maps and the MapKit framework.…","xf7CAeTBsMxG4WUKphnA4aL0RIh0fwQNjjYZpLpVrbw",{"id":2084,"title":2085,"author":2086,"body":2087,"category":2159,"date":2160,"description":2161,"extension":686,"link":2162,"meta":2163,"navigation":242,"path":2164,"seo":2165,"slug":2167,"stem":2168,"tags":2169,"teaser":2171,"__hash__":2172},"blog/blog/google-maps-on-android.md","Google Maps on Android – Part 1: Navigation",[1692],{"type":11,"value":2088,"toc":2157},[2089,2092,2098,2110,2115,2127,2130,2133,2136,2139],[14,2090,2085],{"id":2091},"google-maps-on-android-part-1-navigation",[18,2093,2094,2095,1391],{},"Integrating a google map on android is quiet simple – how to do this basically is shown in\nthe ",[22,2096,1714],{"href":1712,"rel":2097},[26],[18,2099,2100,2101,2106,2107,2109],{},"Showing the map itself is one part, but most likely you want to interact with it in some way. The default map is\ncompletely zoomed out and centred somewhere over America. As this gives you a good idea how America looks like, it is\nnot very useful for showing the location of the Synyx office. So what we need to do, is to move the map to some point\nand zoom in to a certain level. First, lets get the coordinates for the Synyx office. This can easily be done by using\ngoogle maps: Navigate to ",[22,2102,2105],{"href":2103,"rel":2104},"http://maps.google.com",[26],"maps.google.com",", click on the “New” link on the top right and\nactivate the “LatLng Marker” from the Google Maps Labs. This adds an option to the context menu to drop a marker that\nshows the latitude/ longitude values. Use those values to create a new ",[1408,2108,1839],{}," in your Android app:",[18,2111,2112],{},[45,2113,2114],{},"GeoPoint synyxOfficeLocation = new GeoPoint(49002175, 8394160);",[18,2116,2117,2118,2120,2121,2123,2124,981],{},"As the ",[1408,2119,1839],{}," handles its values in microdegrees, the values obtained from google maps must be multiplied with 100 000. Now as we have the GeoPoint, we need to centre the map to it and zoom in to a certain level. To perform this\ntasks, each ",[1408,2122,1892],{}," has a ",[1408,2125,2126],{},"MapController",[18,2128,2129],{},"`MapController mapController = mapView.getController();",[18,2131,2132],{},"mapController.setCenter(synyxOfficeLocation);",[18,2134,2135],{},"mapController.setZoom(20);`",[18,2137,2138],{},"This centres the map to the Synyx office. The zoom level must be a value between 1 (fully zoomed out) and 21 (fully\nzoomed in), so the value of 20 is already quiet close. Please note, that the highest zoom levels might not be available\nfor all areas.",[18,2140,2141,2142,2145,2146,1619,2149,2152,2153,2156],{},"The above mentioned methods change the map in a very static way. For some more visual effects try ",[1408,2143,2144],{},"animateTo()",",\n",[1408,2147,2148],{},"zoomIn()",[1408,2150,2151],{},"zoomOut()"," to change the view of the map by showing a short animation. An also very helpful method is\n",[1408,2154,2155],{},"zoomToSpan()"," which lets you define a latitude and longitude span that should be visible on the map – very handy if you\nwant to ensure that two or more points are visible to the user on the map.",{"title":43,"searchDepth":57,"depth":57,"links":2158},[],[682,683],"2010-04-30T12:42:54","Integrating a google map on android is quiet simple – how to do this basically is shown in\\nthe tutorial on the android developer site.","https://synyx.de/blog/google-maps-on-android/",{},"/blog/google-maps-on-android",{"title":2085,"description":2166},"Integrating a google map on android is quiet simple – how to do this basically is shown in\nthe tutorial on the android developer site.","google-maps-on-android","blog/google-maps-on-android",[694,1362,2170],"interaction","Integrating a google map on android is quiet simple – how to do this basically is shown in the tutorial on the android developer site. Showing the map itself is…","M12KhufnwFTj7q3RUZch3BzzQs8S7YaCZwbJ9q7ROfs",[2174,2177,2180,2183,2186,2189,2192,2195,2198,2201,2204,2207,2210,2213,2216,2219,2222,2225,2228,2231,2234,2237,2239,2242,2245,2248,2251,2253,2256,2259,2262,2265,2268,2271,2274,2277,2279,2282,2285,2288,2291,2294,2297,2300,2302,2305,2308,2311,2314,2317,2320,2323,2326,2329,2332,2335,2338,2341,2344,2347,2350,2353,2356,2358,2361,2364,2367,2370,2373,2376,2379,2382,2385,2388,2390,2393,2396,2399,2402,2405,2408,2411,2414,2417,2420,2423,2426,2429,2432,2435,2438,2441,2444,2447,2450,2453,2456,2459,2462,2464,2467,2470,2473,2476,2478,2481,2484,2487,2490,2493,2496,2499,2502,2505,2508,2511,2514,2517,2520,2523,2526,2529,2532,2535,2538,2541,2544,2547,2550,2553,2555,2558,2561,2564,2567,2570,2573,2576,2579,2582,2585,2588],{"slug":2175,"name":2176},"abel","Jennifer Abel",{"slug":2178,"name":2179},"allmendinger","Otto Allmendinger",{"slug":2181,"name":2182},"antony","Ben Antony",{"slug":2184,"name":2185},"arrasz","Joachim Arrasz",{"slug":2187,"name":2188},"bauer","David Bauer",{"slug":2190,"name":2191},"bechtold","Janine Bechtold",{"slug":2193,"name":2194},"boersig","Jasmin Börsig",{"slug":2196,"name":2197},"buch","Fabian Buch",{"slug":2199,"name":2200},"buchloh","Aljona Buchloh",{"slug":2202,"name":2203},"burgard","Julia Burgard",{"slug":2205,"name":2206},"caspar-schwedes","Caspar Schwedes",{"slug":2208,"name":2209},"christina-schmitt","Christina Schmitt",{"slug":2211,"name":2212},"clausen","Michael Clausen",{"slug":2214,"name":2215},"contargo_poetzsch","Thomas Pötzsch",{"slug":2217,"name":2218},"damrath","Sebastian Damrath",{"slug":2220,"name":2221},"daniel","Markus Daniel",{"slug":2223,"name":2224},"dasch","Julia Dasch",{"slug":2226,"name":2227},"denman","Joffrey Denman",{"slug":2229,"name":2230},"dfuchs","Daniel Fuchs",{"slug":2232,"name":2233},"dobler","Max Dobler",{"slug":2235,"name":2236},"dobriakov","Vladimir Dobriakov",{"slug":2238,"name":2238},"dreiqbik",{"slug":2240,"name":2241},"dschaefer","Denise Schäfer",{"slug":2243,"name":2244},"dschneider","Dominik Schneider",{"slug":2246,"name":2247},"duerlich","Isabell Duerlich",{"slug":2249,"name":2250},"dutkowski","Bernd Dutkowski",{"slug":2252,"name":2252},"eifler",{"slug":2254,"name":2255},"essig","Tim Essig",{"slug":2257,"name":2258},"ferstl","Maximilian Ferstl",{"slug":2260,"name":2261},"fey","Prisca Fey",{"slug":2263,"name":2264},"frank","Leonard Frank",{"slug":2266,"name":2267},"franke","Arnold Franke",{"slug":2269,"name":2270},"frischer","Nicolette Rudmann",{"slug":2272,"name":2273},"fuchs","Petra Fuchs",{"slug":2275,"name":2276},"gari","Sarah Gari",{"slug":1214,"name":2278},"Gast",{"slug":2280,"name":2281},"graf","Johannes Graf",{"slug":2283,"name":2284},"grammlich","Daniela Grammlich",{"slug":2286,"name":2287},"guthardt","Sabrina Guthardt",{"slug":2289,"name":2290},"haeussler","Johannes Häussler",{"slug":2292,"name":2293},"hammann","Daniel Hammann",{"slug":2295,"name":2296},"heetel","Julian Heetel",{"slug":2298,"name":2299},"heft","Florian Heft",{"slug":1692,"name":2301},"Sebastian Heib",{"slug":2303,"name":2304},"heisler","Ida Heisler",{"slug":2306,"name":2307},"helm","Patrick Helm",{"slug":2309,"name":2310},"herbold","Michael Herbold",{"slug":2312,"name":2313},"hofmann","Peter Hofmann",{"slug":2315,"name":2316},"hopf","Florian Hopf",{"slug":2318,"name":2319},"jaud","Alina Jaud",{"slug":2321,"name":2322},"jayasinghe","Robin De Silva Jayasinghe",{"slug":2324,"name":2325},"jbuch","Jonathan Buch",{"slug":2327,"name":2328},"junghanss","Gitta Junghanß",{"slug":2330,"name":2331},"kadyietska","Khrystyna Kadyietska",{"slug":2333,"name":2334},"kannegiesser","Marc Kannegiesser",{"slug":2336,"name":2337},"karoly","Robert Károly",{"slug":2339,"name":2340},"karrasz","Katja Arrasz-Schepanski",{"slug":2342,"name":2343},"kaufmann","Florian Kaufmann",{"slug":2345,"name":2346},"kesler","Mike Kesler",{"slug":2348,"name":2349},"kirchgaessner","Bettina Kirchgäßner",{"slug":2351,"name":2352},"klem","Yannic Klem",{"slug":2354,"name":2355},"klenk","Timo Klenk",{"slug":9,"name":2357},"Tobias Knell",{"slug":2359,"name":2360},"knoll","Anna-Lena Knoll",{"slug":2362,"name":2363},"knorre","Matthias Knorre",{"slug":2365,"name":2366},"koenig","Melanie König",{"slug":2368,"name":2369},"kraft","Thomas Kraft",{"slug":2371,"name":2372},"krupicka","Florian Krupicka",{"slug":2374,"name":2375},"kuehn","Christian Kühn",{"slug":2377,"name":2378},"lange","Christian Lange",{"slug":2380,"name":2381},"larrasz","Luca Arrasz",{"slug":2383,"name":2384},"leist","Sascha Leist",{"slug":2386,"name":2387},"lihs","Michael Lihs",{"slug":1371,"name":2389},"David Linsin",{"slug":2391,"name":2392},"maniyar","Christian Maniyar",{"slug":2394,"name":2395},"martin","Björnie",{"slug":2397,"name":2398},"martin-koch","Martin Koch",{"slug":2400,"name":2401},"matt","Tobias Matt",{"slug":2403,"name":2404},"mennerich","Christian Mennerich",{"slug":2406,"name":2407},"menz","Alexander Menz",{"slug":2409,"name":2410},"meseck","Frederick Meseck",{"slug":2412,"name":2413},"messner","Oliver Messner",{"slug":2415,"name":2416},"michael-ploed","Michael Plöd",{"slug":2418,"name":2419},"mies","Marius Mies",{"slug":2421,"name":2422},"mihai","Alina Mihai",{"slug":2424,"name":2425},"moeller","Jörg Möller",{"slug":2427,"name":2428},"mohr","Rebecca Mohr",{"slug":2430,"name":2431},"moretti","David Moretti",{"slug":2433,"name":2434},"mueller","Sven Müller",{"slug":2436,"name":2437},"muessig","Alexander Müssig",{"slug":2439,"name":2440},"neupokoev","Grigory Neupokoev",{"slug":2442,"name":2443},"nussbaecher","Carmen Nussbächer",{"slug":2445,"name":2446},"ochs","Pascal Ochs",{"slug":2448,"name":2449},"oelhoff","Jan Oelhoff",{"slug":2451,"name":2452},"oengel","Yasin Öngel",{"slug":2454,"name":2455},"oezsoy","Enis Özsoy",{"slug":2457,"name":2458},"posch","Maya Posch",{"slug":2460,"name":2461},"ralfmueller","Ralf Müller",{"slug":2463,"name":2463},"redakteur",{"slug":2465,"name":2466},"reich","Michael Reich",{"slug":2468,"name":2469},"reinhard","Karl-Ludwig Reinhard",{"slug":2471,"name":2472},"rmueller","Rebecca Müller",{"slug":2474,"name":2475},"rosum","Jan Rosum",{"slug":2477,"name":2477},"rueckert",{"slug":2479,"name":2480},"ruessel","Sascha Rüssel",{"slug":2482,"name":2483},"sauter","Moritz Sauter",{"slug":2485,"name":2486},"schaefer","Julian Schäfer",{"slug":2488,"name":2489},"scherer","Petra Scherer",{"slug":2491,"name":2492},"schlicht","Anne Schlicht",{"slug":2494,"name":2495},"schmidt","Jürgen Schmidt",{"slug":2497,"name":2498},"schneider","Tobias Schneider",{"slug":2500,"name":2501},"seber","Benjamin Seber",{"slug":2503,"name":2504},"sommer","Marc Sommer",{"slug":2506,"name":2507},"speaker-fels","Jakob Fels",{"slug":2509,"name":2510},"speaker-gierke","Oliver Gierke",{"slug":2512,"name":2513},"speaker-krupa","Malte Krupa",{"slug":2515,"name":2516},"speaker-mader","Jochen Mader",{"slug":2518,"name":2519},"speaker-meusel","Tim Meusel",{"slug":2521,"name":2522},"speaker-milke","Oliver Milke",{"slug":2524,"name":2525},"speaker-paluch","Mark Paluch",{"slug":2527,"name":2528},"speaker-schad","Jörg Schad",{"slug":2530,"name":2531},"speaker-schalanda","Jochen Schalanda",{"slug":2533,"name":2534},"speaker-schauder","Jens Schauder",{"slug":2536,"name":2537},"speaker-unterstein","Johannes Unterstein",{"slug":2539,"name":2540},"speaker-wolff","Eberhard Wolff",{"slug":2542,"name":2543},"speaker-zoerner","Stefan Zörner",{"slug":2545,"name":2546},"stefan-belger","Stefan Belger",{"slug":2548,"name":2549},"steinegger","Roland Steinegger",{"slug":2551,"name":2552},"stern","sternchen synyx",{"slug":2554,"name":2554},"synyx",{"slug":2556,"name":2557},"szulc","Mateusz Szulc",{"slug":2559,"name":2560},"tamara","Tamara Tunczinger",{"slug":2562,"name":2563},"theuer","Tobias Theuer",{"slug":2565,"name":2566},"thieme","Sandra Thieme",{"slug":2568,"name":2569},"thies-clasen","Marudor",{"slug":2571,"name":2572},"toernstroem","Olle Törnström",{"slug":2574,"name":2575},"ullinger","Max Ullinger",{"slug":2577,"name":2578},"ulrich","Stephan Ulrich",{"slug":2580,"name":2581},"wagner","Stefan Wagner",{"slug":2583,"name":2584},"weigel","Andreas Weigel",{"slug":2586,"name":2587},"werner","Fabian Werner",{"slug":2589,"name":2590},"wolke","Sören Wolke",["Reactive",2592],{"$scookieConsent":2593,"$ssite-config":2595},{"functional":2594,"analytics":2594},false,{"_priority":2596,"env":2600,"name":2601,"url":2602},{"name":2597,"env":2598,"url":2599},-10,-15,0,"production","nuxt-app","https://synyx.de",["Set"],["ShallowReactive",2605],{"category-map":-1,"authors":-1},"/blog/tags/map"]