Mobile Maps SDK v10 - Mapbox
文章推薦指數: 80 %
The Mapbox Mobile SDKs power the most compelling map experiences available on iOS and Android. Version 10 brings new capabilities, amazing performance and a ... MapsSDKv10.Readtheblogpost→HomepageProductsMapsSmooth,fast,real-timemapsNavigationSDKTurn-by-turnroutingStudioDesigncustommapsDataBuildwithMapboxdataSearchSearchpoints-of-interest,addresses,andplacesMapboxGLJSJavaScriptlibraryforvectormapsStaticMapsDisplayyourmapsanywhereMapboxTilingServiceTransformgeodataintovectortilesMovementdataDatasetofpopulationmovementDashBeautifulmaps,livetraffic,musicandvoiceforcarsBoundaries4millionglobalboundariesMobilemapsSDKThemostcompellingmapexperienceVisionSecondsetofeyesforyourcarAtlasMapboxon-premises AddressAutofillSimplifyandenhanceaddressformfillSolutionsLogisticsAutomotiveOutdoorsRetailTravelBusinessintelligenceRealEstateDevelopersDocumentationWebinarsHow-to-videosDeveloperNetworkSupportCompanyAboutMapboxCareersSustainabilityCommunityEducationPressContactCustomersPricingBlogLoginSignupViewaccountFasterthaneverv10makesourindustry-leadingmapperformanceevenfaster.Maploadsare25-40%fasterinreal-worldscenarios.Bandwidthrequirementsarecutbyupto18%whenusinglocalfonts.BOSTONZL9SANFRANCISCOZL14TOKYOZL13V10legacy25-40%fasterinreal-worldscenarios18%achievablebandwidthsavingsThreedimensionsineightlinesofcodeEnabling3Dterrainisamazinglysimple.Smartdefaultgesturesupportprovidesintuitiveinteractionintwodimensionsorthree.GettheperfectshotNewcameracapabilitiesletyoushowuserseveryinchofmapthatyouwanttohighlight--anddoitinwaysthey’veneverseenbefore.Integrationwithplatforms’nativeanimationsystemsmeansyoursceneswillbeperformantandfamiliartodesign.Lesscode==fewerbugsArefactoredandmodulararchitecturereducestheneedforboilerplateandthepotentialfordevelopererror.Anewdomain-specificlanguagemakesworkingwithstylesmoreintuitive.classSimpleMapActivity: AppCompatActivity(){ overridefunonCreate(savedInstanceState:Bundle?){ super.onCreate(savedInstanceState) setContentView(R.layout.activity_simple_map) mapView.getMapboxMap().loadStyle( style(Style.MAPBOX_STREETS){ +image("test-image"){ bitmap(BitmapFactory.decodeResource(resources,R.drawable.red_marker)) } +geoJsonSource("source-id"){ geometry(Point.fromLngLat(0.0,0.0)) } +symbolLayer("symbol-layer-id","source-id"){ iconImage("test-image") iconOpacity(0.8) iconAllowOverlap(true) iconSize(0.9) } } ) } overridefunonStart(){ super.onStart() mapView.onStart() } overridefunonStop(){ super.onStop() mapView.onStop() } overridefunonLowMemory(){ super.onLowMemory() mapView.onLowMemory() } overridefunonDestroy(){ super.onDestroy() mapView.onDestroy() }}ModernfoundationsAcompleterewriteinKotlinandSwiftensuresaseamlessexperiencefordevelopers.v10alsobringssupportforemergingstandardslikeSPMandMetal.Tested&trustedMapsareanintegralpartoftheentireAccuWeatherexperience.TheMapboxMapsSDKshelpedstreamlinedevelopmentcyclesandenabledAccuWeathertoconsolidatefromsixdifferentmappingproviderstojustone.Exploretheshowcase→With100,000trails,reviews,andphotosfrom10millionoutdoorenthusiasts,AllTrailsisworkingtobuildthelargestcollectionofhand-curatedtrailguidestohelpeveryoneexploretheoutdoorswithconfidence.Exploretheshowcase→LonelyPlanetusesMapbox’splatformtohelptravelersdiscoverwheretogobyplottingareasofinterestintheTripsApp.Exploretheshowcase→Ifyoucan’twaittogetontheroadagain,Roadtrippersgetsyouoffthebeatenpath,goingplacesthatyou’veneverbeen,andseeingthingsthatyoumayneverseeagain.Exploretheshowcase→Ifit'sbeenrunorridden,it'sonStrava.Everyactivityisprojectedonatotallycustom,modern-minimalisticmapstyledesignedtohighlightthedetailsrunnersandcyclistslovetosee.Exploretheshowcase→Whetheryou'reexploringthehighestpeaksorjustoutforaneighborhoodjog,theSuuntoApponiOSandAndroidmakeseverymovecount.Exploretheshowcase→Withaninteractivemap,Zenlyletsyouseeexactlywherefriendsareanduseourdirectionstoolstomeetupwiththem-allwithoutleavingtheapp.Exploretheshowcase→"WeuseMapboxStaticTileAPIstoenhanceourmappingexperience.MapboxtechnologyisacentralpartofourinfrastructureandwefoundtheperformanceoftheseAPIstobebetterthanotherproviders."JamesGraham,HeadofEngineeringatAllTrailsGettingStartedHowtogetstartedwiththeMapboxMobileSDKs. iOSmapsguide. Androidmapsguide.MigrationGuideResourcesforupgradingyourapptov10. iOSmigrationtov10guide. Androidmigrationtov10guide.APIDocsDetaileddocumentationforAndroidandiOS. iOSmapsAPIreference. AndroidmapsAPIreference.ExampleCodeAgrowinglistofrecipesforcommontasksusingtheMapboxMobileSDKs. iOSmapscodeexamples. Androidmapscodeexamples.SourceReposDigintotheSDK codeonGithub. iOSmapssoursrepos. Androidmapssoursrepos.FrequentlyAskedQuestionsWhatisv10?v10isthelatestversionoftheMapboxMapsSDKforiOSandAndroid.Itsucceedsthe6.xlineoniOSandthe9.xlineonAndroid.v10bringssubstantialperformanceimprovements;newfeatureslike3Dterrainandamorepowerfulcamera;moderntechnicalfoundations;andabetterdeveloperexperience.Howmuchfasterisv10?Usingreal-worldmapstylesandlocations,v10’soverallTimeToRenderCompletion(TTRC)istypically25to35%fasterthanearlierversionsoftheSDKoniOSand25to40%fasteronAndroid.Whatisv10’simpactonnetworkefficiency?Thankstolocalglyphcapabilitiesandotheroptimizations,v10’sbandwidthrequirementsforinitialmaploadcanbeupto18%smallerthanearlierversionsoftheSDK.Glyphsaretheindividualsymbolsthatcompriseafont.TheMapboxplatformgivesusersdeepcontroloverthefontsusedinamapstyle.Typically,thosefontsmustbedownloadedalongwiththemapstyle.Theseresourcescanbeasignificantportionofinitialnetworkactivity,particularlyforCJKfontswithlargecharactersets.v10includessupportforlocalglyphs--thealready-downloadedfontcharactersmadeavailablebythemobileoperatingsysteminaccordancewithitslocale.Usinglocalglyphsavoidstheneedtodownloadfonts,whichcanresultinsubstantialefficiencygains.Howdoesv10improvecaching?Efficientmaprenderingdependsuponmultipletypesofresourcecaching.EarlierversionsoftheMapsSDKemployedbasicheuristicstodeterminewhattocache,when,andforhowlong.v10’snewpredictiveambientcacheexamineshowthemapisbeingused--includingeverythingfromcoarseheadingtosearchactivity--tomakebetterguessesaboutwhatresourcesshouldbefetchedforfutureuse.Resourcesareretrievedwithlessnetworkoverheadandimprovedtoleranceforintermittentconnectivity.Andcacheexpirationhasbeenimprovedtoboostefficiencyandensurethatmaps,navigationandotherservicesstayinsyncasdataisupdated.What3Dcapabilitiesareavailableinv10?v10includes3Dterrainandskyboxsupport,aswellthenewglobeviewAPIonapreviewbasis.Inordertounlockthefullpotentialof3D,thesenewfeaturesarepairedwithanewandmorepowerfulcamerasystem.Additional3Dcapabilitiesareunderdevelopmentandwillbeannouncedbyemailandblogastheybecomeavailable.Whatcanthenewcamerasystemdo?PriorversionsoftheMapsSDKincludedsupportforbasicanimationswitheasing,includingsimplepanning,rotation,pitch,andtheparabolicflyTomethod.Thesemethodsremainavailable,butarenowaugmentedwithsupportforcomplextransformationsthrough3Dspace.AdvancedcamerasupportisintegratedwiththenativeiOSandAndroidanimationframeworks,providingafamiliarexperiencefordevelopersandaperformantoneforendusers.Howhasv10beenoptimizedfornavigation?NavigationusecaseshavebeenprioritizedthroughoutthedevelopmentofMapsSDKv10.Labelpositionsaremorestableasthecamerafollowsaroute.Anewapproachtotileloadingwhenviewingthemapathigh-pitchorientationsimprovesefficiencyandlevelofdetail.Supportfornine-partimagesreduceshighwayshields’storageimpactandimprovestheirflexibility.Apredictivecachingsystempreloadsresourcesintelligentlywhenatripisunderway.Theuserlocationpuckhasbeenrewrittentobemoreaccurateandflexible--in2or3dimensions.Andoptimizeddistanceandwithinexpressionsprovidehighlyperformantfeaturefilteringalongroutelines.TheseandotherimprovementscombinewiththeMapboxNavigationSDKtoprovideasuperbnavexperience.WhatistheSnapshotterandhowhasitbeenenhanced?TheMapsSDKSnapshotterprovidesprogrammaticmethodsforgeneratingstaticimagesofrenderedmaps.Theseimagesareoftenusedinappsforthumbnails,previews,orinothercircumstanceswherethefullcapabilitiesofaMapboxMapinstancearenotrequired.SnapshotterisbroadlycomparabletotheMapboxStaticImagesAPI,butitconsumesmorelocalresourcesandhasfewerstylinglimitations.Inv10,theSnapshotterhasbecomeevenmorepowerful,addingsupportforcapturingruntimestylingchangestothemap.WhatisMetal?HowdoIuseitwithMapboxMaps?MetalisanAppleAPIforinterfacingwithGPUs.ItisthesuccessortoOpenGLonAppleplatforms.MetalfillsthesamefunctionalroleasOpenGL,butofferssubstantiallyimprovedperformanceandamoreefficientinterfacetounderlyinghardware.AppledeprecatedOpenGLsupportinsummer2018.Sincethattime,iOSandMacdevelopershavebeenstronglyencouragedtobeginusingMetal,inanticipationofAppleproductsceasingtosupportOpenGL.AspecificdatefortheendofOpenGLsupporthasnotbeenannounced,butthecurrentdeprecationperiodhasalreadylastedlongerthanmanyobserversexpected.ByusingtheMapsSDKv10,yourmapswillrenderwithMetalandbefullysupportedforyouriOSusersnowandintothefuture.UnlikesomecompetingSDKs,v10'sMetalsupportisnotbasedonaninefficienttranslationlayerthatrewritesOpenGL callsintoMetal: it'sdesignedfromscratchtofullyunlockthistechnology'spotential.IfyouupgradetotheMapsSDKv10foriOS,Metalsupportwillbeautomaticallyenabledforyourendusers.NootherchangesarenecessaryunlessyouhaveimplementedcustomOpenGLlayersbyusingtheMGLOpenGLStyleLayerAPI.Ifyouhave,thoselayersmustbeportedtoMetalusingtheMapsSDK’sMGLMetalStyleLayerAPI.DoestheMapsSDKv10supportbothMetalandOpenGL?NotoniOS.TheiOSSDKv10onlysupportsMetal.MetalissupportedonalldevicesthatuseAppleA7chipsandnewer(iPhone5S,5SE,iPhone6andlater,aswellasiPadAir,iPadMini2,iPadMini3andlater),whichmakeupover99%ofallactiveiOSdevices.ItisnotavailableontheiPhone5oriPad4(lessthan1%ofallactiveiOSdevices).WewillcontinuetosupportthelegacyMapsSDKforiOSwithOpenGLrenderingonly.MetalisonlyavailableonAppledevices.TheAndroidSDKv10continuestouseOpenGL.Howhassupportforworkingwithstylesbeenimproved?Althoughundeniablypowerful,manipulatingstylesandMapboxExpressionswasasometimesawkwardexperiencefordevelopersusingearlierversionsoftheSDK.Inv10,adomain-specificlanguage(DSL)improvestheexperienceofchangingstylesonbothiOSandAndroid.BymeldingtheJSONoftheMapboxStyleSpecificationwithfamiliarprimitivesfromeachplatform,theseDSLsensurethatSwiftandKotlindeveloperswillfindtheexperienceofworkingwithstylesandexpressionsmuchmoreintuitivethaninthepast.Howdoesv10reducecrashes?TheMapsSDKv10substantiallyreducescrashingbehaviorintwoways:architecturalchangesthatimproveobjectlifecyclehandlingandremovecommonsourcesoferror;andcapturingallC++exceptionssothattheycanbeproperlyhandled.Howhasobjectlifecyclehandlingbeenimproved?TheMapsSDKv10hasremovedoneofthebiggestpitfallsintheLegacySDK:objectlifecycleerrors.Previously,theSDKimplementedStyle,Layer,andSourceobjectsthatmirroredthesameobjectsinthecoreC++library.InC++,LayerandSourceobjectsbelongedtotheStyleobject,whichcouldberesetinwaysthatresultedinstrandedLayerandSourceobjectsintheSDK.IntheMapsSDKv10,everythingishandledintheMapobjectsothatstylechangesdonotresultindanglingpointers,crashes,orotherlifecycleissues.Howhasexceptionhandlingbeenimproved?TheMapsSDKv10capturesallC++exceptionsfromthecorelibrary,preventingthemfromleakingtotheplatform.Leakyexceptionsareproblematicbecausetheycancausecrashesandbecausetheytypicallyprovideinsufficientdetailfordevelopersworkingtoidentifytherootproblem.HowistheMapsSDKv10distributed?TheMapsSDKv10foriOSispublishedontheMapboxwebsiteandviaSwiftPackageManagerandCocoapods.TheMapsSDKv10forAndroidispublishedviaMaven.HowistheMapsSDKv10licensed?TheMapboxiOSSDKv10isavailabletocustomersfordistributionintheirapplicationsaccordingtotheMapboxTermsofService.WhereisthesourcecodefortheMapsSDKv10?YoucanfindMapsSDKv10sourcecodeforiOSandAndroidathttps://github.com/mapbox/mapbox-maps-iosandhttps://github.com/mapbox/mapbox-maps-android,respectively.Whatistheminimumdeploymenttargetforv10?ForAppledevices,theminimumdeploymenttargetforMapsSDKv10isiOS11.ForAndroid,theminimumdeploymenttargetforMapsSDKv10.0isAndroidAPIlevel21(Lollipop).DoesMapboxcontinuetosupportearlierversionsoftheSDK?Yes.Toavoiddisruptionsforcustomersandusersduringthemigrationtov10,thelegacyObject-CandJavaSDKsarestillsupportedatthistime.WhichfeatureswillbebackportedtoearlierversionsoftheSDK?ThelegacyMapsSDKswillcontinuetoreceivebugfixes.Wemayalsopublishcompatibilitychangestoensurethatcustomerswhoareunabletoquicklytransitiontov10donotexperienceregressions.However,mostnewfunctionalitywillnotbebackportedtothelegacyMapsSDK.Weencouragecustomerstobeginplanningtheirupgradetov10assoonaspossible.CanIusemyownTile/Fonts/Icons/StylesAPIswithMapsSDKv10?Yes.YoucanusetheMapboxMapsSDKwithoneormoremapresources(tiles,fonts,icons,styles,etc.)servedviayourownAPIsforavarietyofusecases,whetherthat’srunninganapplicationonaprivatenetworkorintegratingwithlegacyorcustomapplicationimplementations.CanIauthenticateagainstmyownAPIwiththeMapsSDKv10?Yes.ByreplacingthedefaultHTTPnetworkrequestorwithacustomimplementation,youcanaddcustomauthenticationheadersormodifyrequestsasnecessarytoauthorizerequestsagainstyourownservice.DoingsowillnotinterferewiththeSDK’sabilitytovalidateyourMapboxtokenforusewithourservices.WillmyusersstillbecountedasMAUsifIusemyowncustomAPIswithMapsSDKv10?Yes.AnyactiveinstalledinstancesoftheMapboxMapsSDKthatrendersamapistrackedasaMobileActiveUserformeteringandbillingpurposes.HowmuchdoestheMapsSDKv10cost?PricingfortheMapsSDKv10releaseisconsistentwithrecentreleasesofourmobileSDKs.Wehavealargefreetierallowingupto25,000monthlyactiveusers(MAUs).Forpricingbeyond25,000users,pleaseseethepricingcalculatoronhttps://www.mapbox.com/pricing/.CanIusetheMapsSDKv10fromObjective-C?Notdirectly.IfyouriOSapplicationiswritteninObjective-C,youwillneedtowriteaSwiftcompatibilityshimforthosepartsofthepublicAPIthatyourapplicationuses.ThisisbecausetheSDKusespureSwiftconstructsthatcannotbeusedfromObjective-Cdirectly,forexample,associatedenums,defaultvalues,the`Resulttype`andsimilar.companyAboutCustomersCommunityCareersSustainabilityDiversity&InclusionTeamBlogPressContactSUPPORTHelpSupportServicesDocumentationOpensourceProductsMapsNavigationAtlasSearchStudioVisionAddressAutofillData—PricingResourcesIndustriesUseCasesHow-toVideosWebinarsEvents©MapboxTermsPrivacySecurity
延伸文章資訊
- 1Mapbox: Maps, geocoding, and navigation APIs & SDKs
Integrate custom live maps, location search, and turn-by-turn navigation into any mobile or web a...
- 2@mapbox/mapbox-sdk - npm
JS SDK for accessing Mapbox APIs. Latest version: 0.13.3, last published: 2 months ago. Start usi...
- 3Examples | Maps SDK | Android | Mapbox
Code examples for the Mapbox Maps SDK for Android. ... You can find additional examples for the M...
- 4Maps SDK | Android | Mapbox
The Mapbox Maps SDK for Android is a library for embedding highly customized maps within Android ...
- 5API Reference | Maps SDK | Android | Mapbox
The Mapbox Maps SDK for Android is a toolset for displaying maps inside of your Android applicati...