启动 Windows 地图应用Launch the Windows Maps app

了解如何从你的应用启动 Windows 地图应用。Learn how to launch the Windows Maps app from your app. 本主题介绍了 bingmaps:ms-drive-to:ms-walk-to:ms-settings: 统一资源标识符 (URI) 方案。This topic describes the bingmaps:, ms-drive-to:, ms-walk-to:, and ms-settings: Uniform Resource Identifier (URI) schemes. 使用这些 URI 方案来将 Windows 地图应用启动为特定的地图、路线和搜索结果或从“设置”应用下载 Windows 地图离线地图。Use these URI schemes to launch the Windows Maps app to specific maps, directions, and search results or to download Windows Maps offline maps from the Settings app.

提示 若要了解有关从你的应用启动 Windows 地图应用的详细信息,请从 GitHub 上的 Windows 通用示例存储库中下载通用 Windows 平台 (UWP) 地图示例Tip To learn more about launching the Windows Maps app from your app, download the Universal Windows Platform (UWP) map sample from the Windows-universal-samples repo on GitHub.

URI 简介Introducing URIs

URI 方案允许你通过单击超链接(或在你的应用中以编程方式)打开应用。URI schemes let you open apps by clicking hyperlinks (or programmatically, in your app). 正如可以使用 mailto: 打开新的电子邮件或使用 http: 打开 Web 浏览器,你还可以使用 bingmaps:ms-drive-to:ms-walk-to: 打开 Windows 地图应用。Just as you can start a new email using mailto: or open a web browser using http:, you can open the Windows maps app using bingmaps:, ms-drive-to:, and ms-walk-to:.

  • bingmaps: URI 提供附带位置、搜索结果、路线和路况的地图。The bingmaps: URI provides maps for locations, search results, directions, and traffic.
  • ms-drive-to: URI 提供从你的当前位置开始的行车路线规划。The ms-drive-to: URI provides turn-by-turn driving directions from your current location.
  • ms-walk-to: URI 提供从你的当前位置开始的步行路线规划。The ms-walk-to: URI provides turn-by-turn walking directions from your current location.

例如,以下 URI 将打开 Windows 地图应用,并显示以纽约市为中心的地图。For example, the following URI opens the Windows Maps app and displays a map centered over New York City.

<bingmaps:?cp=40.726966~-74.006076>

以纽约市为中心的地图。

下面是 URI 方案的说明:Here is a description of the URI scheme:

bingmaps:?查询bingmaps:?query

在此 URI 方案中,query 是一系列参数名称/值对:In this URI scheme, query is a series of parameter name/value pairs:

& param1 = value1 & param2 = value2 。&param1=value1&param2=value2 …

有关可用参数的完整列表,请参阅 bingmaps:ms-drive-to:ms-walk-to: 参数引用。For a full list of the available parameters, see the bingmaps:, ms-drive-to:, and ms-walk-to: parameter reference. 本主题的后面还会提供示例。There are also examples later in this topic.

从你的应用启动 URILaunch a URI from your app

若要从你的应用启动 Windows 地图应用,请使用 bingmaps: ms-drive-to:ms-walk-to: URI 调用LaunchUriAsync 方法。To launch the Windows Maps app from your app, call the LaunchUriAsync method with a bingmaps:, ms-drive-to:, or ms-walk-to: URI. 以下示例启动前一个示例中相同的 URI。The following example launches the same URI from the previous example. 有关通过 URI 启动应用的详细信息,请参阅启动 URI 的默认应用For more info about launching apps via URI, see Launch the default app for a URI.

// Center on New York City
var uriNewYork = new Uri(@"bingmaps:?cp=40.726966~-74.006076");

// Launch the Windows Maps app
var launcherOptions = new Windows.System.LauncherOptions();
launcherOptions.TargetApplicationPackageFamilyName = "Microsoft.WindowsMaps_8wekyb3d8bbwe";
var success = await Windows.System.Launcher.LaunchUriAsync(uriNewYork, launcherOptions);

在此示例中,LauncherOptions 类用于帮助确保启动 Windows 地图应用。In this example, the LauncherOptions class is used to help ensure the Windows Maps app is launched.

显示已知的位置Display known locations

可以使用许多选项来控制要显示的地图部分。There are many options to control which part of the map to show. 你可以将 cp(中心点)参数与 rad(半径)或 lvl(缩放级别)参数配合使用,以显示位置,并选择接近度以对其进行放大。You can use the cp (center point) parameter with either the rad (radius) or the lvl (zoom level) parameters to show a location and choose how close to zoom in to it. 当你使用 cp 参数时,你还可以指定 hdg(标题)和 pit(倾斜)以控制要查看的方向。When you use the cp parameter, you can also specify a hdg (heading) and pit (pitch) to control what direction to look. 另一种方法是使用 bb(边界框)参数来提供你想要显示的区域的最大东、南、西、北坐标。Another method is to use the bb (bounding box) parameter to provide the maximum south, east, north, and west coordinates of the area you want to show.

若要控制视图类型,请使用 sty(样式)和 ss(Streetside)参数。To control the type of view, use the sty (style) and ss (Streetside) parameters. sty 参数允许你在路线图和鸟瞰图之间切换。The sty parameter lets you switch between road and aerial views. ss 参数将地图置于 Streetside 视图。The ss parameter puts the map into a Streetside view. 有关这些参数和其他参数的详细信息,请参阅 bingmaps: 参数引用For more info about these and other parameters, see the bingmaps: parameter reference.

示例 URISample URI 结果Results
bingmaps:?bingmaps:? 打开地图应用。Opens the Maps app.
bingmaps:?cp=40.726966~-74.006076bingmaps:?cp=40.726966~-74.006076 显示以纽约市为中心的地图。Displays a map centered over New York City.
bingmaps:?cp=40.726966~-74.006076&lvl=10bingmaps:?cp=40.726966~-74.006076&lvl=10 使用缩放级别 10 显示以纽约市为中心的地图。Displays a map centered over New York City with a zoom level of 10.
bingmaps:? bb = 39.719_-74.52 ~ 41.71_-73。5bingmaps:?bb=39.719_-74.52~41.71_-73.5 显示纽约市(bb 参数中指定的区域)的地图。Displays a map of New York City, which is the area specified in the bb argument.
bingmaps:? bb = 39.719_-74.52 ~ 41.71_-73.5 & cp = 47 ~-122bingmaps:?bb=39.719_-74.52~41.71_-73.5&cp=47~-122 显示纽约市(使用边界框参数指定的区域)的地图。Displays a map of New York City, which is the area specified in the bounding box argument. 将忽略使用 cp 参数为西雅图指定的中心点,因为指定了 bbThe center point for Seattle specified in the cp argument is ignored because bb is specified.
bingmaps:? collection = 36.116584_-115.176753_Caesars% 20Palace & lvl = 16bingmaps:?collection=point.36.116584_-115.176753_Caesars%20Palace&lvl=16 显示名为恺撒王宫酒店的某个点(位于拉斯维加斯)的地图并将缩放级别设置为 16。Displays a map with a point named Caesars Palace (in Las Vegas) and sets the zoom level to 16.
bingmaps:? collection = 40.726966_-74.006076_部分% 255FBusinessbingmaps:?collection=point.40.726966_-74.006076_Some%255FBusiness 显示一个地图,该地图具有一个名为 "某些_业务" 的点(在拉斯维加斯中)。Displays a map with a point named Some_Business (in Las Vegas).
bingmaps:?cp=40.726966~-74.006076&trfc=1&sty=abingmaps:?cp=40.726966~-74.006076&trfc=1&sty=a 显示纽约市的地图并已启用路况和鸟瞰图样式。Displays a map of New York City with traffic on and aerial map style.
bingmaps:?cp=47.6204~-122.3491&sty=3dbingmaps:?cp=47.6204~-122.3491&sty=3d 显示 Space Needle 的 3D 视图。Displays a 3D view of the Space Needle.
bingmaps:?cp=47.6204~-122.3491&sty=3d&rad=200&pit=75&amp;hdg=165bingmaps:?cp=47.6204~-122.3491&sty=3d&rad=200&pit=75&hdg=165 显示 Space Needle 的 3D 视图(半径 200 米、俯仰 75 度和方位 165 度)。Displays a 3D view of the Space Needle with a radius of 200m, a pitch of 75 degrees, and a heading of 165 degrees.
bingmaps:?cp=47.6204~-122.3491&ss=1bingmaps:?cp=47.6204~-122.3491&ss=1 显示 Space Needle 的街景视图。Displays a Streetside view of the Space Needle.

显示搜索结果Display search results

使用 q 参数搜索位置时,我们建议尽可能使用特定搜索词,并使用 cpbbwhere 参数指定搜索位置。When searching for places using the q parameter, we recommend making the terms as specific as possible and using the cp, bb, or where parameters to specify a search location. 如果你未指定搜索位置,并且用户的当前位置不可用,则搜索可能不会返回有意义的结果。If you do not specify a search location and the user's current location isn't available, the search may not return meaningful results. 搜索结果将显示在最合适的地图视图中。Search results are displayed in the most appropriate map view. 有关这些参数和其他参数的详细信息,请参阅 bingmaps: 参数引用For more info about these and other parameters, see the bingmaps: parameter reference.

示例 URISample URI 结果Results
bingmaps:?q=1600%20Pennsylvania%20Ave,%20Washington,%20DCbingmaps:?q=1600%20Pennsylvania%20Ave,%20Washington,%20DC 显示地图并搜索位于华盛顿哥伦比亚特区的白宫的地址。Displays a map and searches for the address of the White House in Washington, D.C.
bingmaps:?q=coffee&where=Seattlebingmaps:?q=coffee&where=Seattle 搜索西雅图的咖啡馆。Searches for coffee in Seattle.
bingmaps:?cp=40.726966~-74.006076&where=New%20Yorkbingmaps:?cp=40.726966~-74.006076&where=New%20York 在指定的中心点附近搜索纽约。Searches for New York near the specified center point.
bingmaps:? bb = 39.719_-74.52 ~ 41.71_-73.5 & q = 比萨饼bingmaps:?bb=39.719_-74.52~41.71_-73.5&q=pizza 在指定的边框(即在纽约市)搜索比萨。Searches for pizza in the specified bounding box (that is, in New York City).

 

显示多个点Display multiple points

使用 collection 参数在地图上显示一组自定义的点。Use the collection parameter to show a custom set of points on the map. 如果存在多个点,将显示点的列表。If there is more than one point, a list of points is displayed. 一个集合中最多可以包含 25 个点,它们按所提供的顺序列出。There can be up to 25 points in a collection and they are listed in the order provided. 集合优先于搜索和路线请求。The collection takes precedence over search and directions requests. 有关此参数和其他参数的详细信息,请参阅 bingmaps: 参数引用For more info about this parameter and others, see the bingmaps: parameter reference.

示例 URISample URI 结果Results
bingmaps:? collection = 36.116584_-115.176753_Caesars% 20Palacebingmaps:?collection=point.36.116584_-115.176753_Caesars%20Palace 搜索拉斯维加斯的恺撒王宫酒店,并在地图上以最佳的地图视图显示结果。Searches for Caesar's Palace in Las Vegas and displays the results on a map in the best map view.
bingmaps:? collection = 36.116584_-115.176753_Caesars% 20Palace & lvl = 16bingmaps:?collection=point.36.116584_-115.176753_Caesars%20Palace&lvl=16 显示名为恺撒王宫酒店(位于拉斯维加斯)的图钉,缩放级别为 16。Displays a pushpin named Caesars Palace in Las Vegas and zooms to level 16.
bingmaps:? collection = 36.116584_-115.176753_Caesars% 20Palace ~_-115.175188_% 36.113126 & 20Bellagio = 16 & cp = lvl ~-115.176669bingmaps:?collection=point.36.116584_-115.176753_Caesars%20Palace~point.36.113126_-115.175188_The%20Bellagio&lvl=16&cp=36.114902~-115.176669 显示名为恺撒王宫酒店和百乐宫酒店(均位于拉斯维加斯)的两枚图钉,缩放级别为 16。Displays a pushpin named Caesars Palace and a pushpin named The Bellagio in Las Vegas and zooms to level 16.
bingmaps:? collection = 40.726966_-74.006076_虚假% 255FBusiness% 255Fwith% 255FUnderscorebingmaps:?collection=point.40.726966_-74.006076_Fake%255FBusiness%255Fwith%255FUnderscore 使用带有_下划线的名为虚设_Business_的图钉显示纽约。Displays New York with a pushpin named Fake_Business_with_Underscore.
bingmaps:? collection = name。宾馆% 20List ~ 36.116584_-115.176753_Caesars% 20Palace ~_-115.175188_% 36.113126 & 20Bellagio = 16 & cp = lvl ~-115.176669bingmaps:?collection=name.Hotel%20List~point.36.116584_-115.176753_Caesars%20Palace~point.36.113126_-115.175188_The%20Bellagio&lvl=16&cp=36.114902~-115.176669 显示名为酒店列表的列表,以及拉斯维加斯的恺撒王宫酒店和百乐宫酒店的两枚图钉,缩放级别为 16。Displays a list named Hotel List and two pushpins for Caesars Palace and The Bellagio in Las Vegas and zooms to level 16.

 

显示路线和路况Display directions and traffic

你可以使用 rtp 参数显示两个点之间的路线;这些点可以是地址或纬度和经度坐标。You can display directions between two points using the rtp parameter; those points can be either addresses or latitude and longitude coordinates. 使用 trfc 参数显示路况信息。Use the trfc parameter to show traffic information. 若要指定路线的类型:驾车、步行或公交,请使用 mode 参数。To specify the type of directions: driving, walking, or transit, use the mode parameter. 如果未指定 mode,将使用用户的首选交通模式提供路线。If mode isn't specified, directions will be provided using the user's preferred mode of transportation. 有关这些参数和其他参数的详细信息,请参阅 bingmaps: 参数引用For more info about these parameters and others, see the bingmaps: parameter reference.

路线的示例

示例 URISample URI 结果Results
bingmaps:? rtp = 44.9160_-110.4158 ~ pos 45.0475_-109.4187bingmaps:?rtp=pos.44.9160_-110.4158~pos.45.0475_-109.4187 显示带有点对点路线的地图。Displays a map with point-to-point directions. 因为未指定 mode,所以将使用交通首选项的用户的模式提供路线。Because mode is not specified, directions will be provided using the user's mode of transportation preference.
bingmaps:?cp=43.0332~-87.9167&trfc=1bingmaps:?cp=43.0332~-87.9167&trfc=1 显示以威斯康辛州的密尔沃基市为中心的地图以及路况。Displays a map centered over Milwaukee, WI with traffic.
bingmaps:? rtp = adr。一种 Microsoft 方法,Redmond,WA 98052 ~ 39.0731_-108.7238bingmaps:?rtp=adr.One Microsoft Way, Redmond, WA 98052~pos.39.0731_-108.7238 显示带有从指定的地址到指定位置的路线的地图。Displays a map with directions from the specified address to the specified location.
bingmaps:? rtp = adr% 20Microsoft% 20Way,% 20Redmond,% 20WA,%2098052 ~_-111.9495_总计% 36.1223% 20Canyon% 20northernbingmaps:?rtp=adr.1%20Microsoft%20Way,%20Redmond,%20WA,%2098052~pos.36.1223_-111.9495_Grand%20Canyon%20northern%20rim 显示从 1 Microsoft Way, Redmond, WA, 98052 到 Grand Canyon's northern rim 的路线。Displays directions from 1 Microsoft Way, Redmond, WA, 98052 to the Grand Canyon's northern rim.
bingmaps:?rtp=adr.Davenport, CA~adr.Yosemite Villagebingmaps:?rtp=adr.Davenport, CA~adr.Yosemite Village 显示地图以及从指定的位置到指定的地标的驾车路线。Displays a map with driving directions from the specified location to the specified landmark.
bingmaps:?rtp=adr.Mountain%20View,%20CA~adr.San%20Francisco%20International%20Airport,%20CA&mode=dbingmaps:?rtp=adr.Mountain%20View,%20CA~adr.San%20Francisco%20International%20Airport,%20CA&mode=d 显示从芒廷维尤到旧金山国际机场(这两者均位于加利福尼亚州)的驾车路线。Displays driving directions from Mountain View, CA to San Francisco International Airport, CA.
bingmaps:?rtp=adr.Mountain%20View,%20CA~adr.San%20Francisco%20International%20Airport,%20CA&mode=wbingmaps:?rtp=adr.Mountain%20View,%20CA~adr.San%20Francisco%20International%20Airport,%20CA&mode=w 显示从芒廷维尤到旧金山国际机场(这两者均位于加利福尼亚州)的步行路线。Displays walking directions from Mountain View, CA to San Francisco International Airport, CA.
bingmaps:?rtp=adr.Mountain%20View,%20CA~adr.San%20Francisco%20International%20Airport,%20CA&mode=tbingmaps:?rtp=adr.Mountain%20View,%20CA~adr.San%20Francisco%20International%20Airport,%20CA&mode=t 显示从芒廷维尤到旧金山国际机场(这两者均位于加利福尼亚州)的公交路线。Displays transit directions from Mountain View, CA to San Francisco International Airport, CA.

显示路线规划Display turn-by-turn directions

ms-drive-to:ms-walk-to: URI 方案允许你直接启动到路线的规划视图。The ms-drive-to: and ms-walk-to: URI schemes let you launch directly into a turn-by-turn view of a route. 这些 URI 方案只能提供自用户的当前位置开始的路线。These URI schemes can only provide directions from the user's current location. 如果必须提供未包含用户的当前位置的点之间的路线,请使用先前部分中所述的 bingmaps: URI 方案。If you must provide directions between points that do not include the user's current location, use the bingmaps: URI scheme as described in the previous section. 有关这些 URI 方案的详细信息,请参阅 ms-drive-to:ms-walk-to: 参数引用。For more info about these URI schemes, see the ms-drive-to: and ms-walk-to: parameter reference.

重要提示 当启动 ms-drive-to:ms-walk-to: URI 方案时,“地图”应用将检查设备是否曾有过 GPS 位置定位。Important When the ms-drive-to: or ms-walk-to: URI schemes are launched, the Maps app will check to see if the device has ever had a GPS location fix. 如果有,则“地图”应用将继续进行路线规划。If it has, then the Maps app will proceed to turn-by-turn directions. 如果没有,应用将显示路线概述,如显示路线和路况中所述。If it hasn't, the app will display the route overview, as described in Display directions and traffic.

路线规划的示例

示例 URISample URI 结果Results
ms-drive-to:?destination.latitude=47.680504&destination.longitude=-122.328262&amp;destination.name=Green Lakems-drive-to:?destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake 显示地图以及从你的当前位置到 Green Lake 的驾车路线规划。Displays a map with turn-by-turn driving directions to Green Lake from your current location.
ms-walk-to:?destination.latitude=47.680504&destination.longitude=-122.328262&amp;destination.name=Green Lakems-walk-to:?destination.latitude=47.680504&destination.longitude=-122.328262&destination.name=Green Lake 显示地图以及从你的当前位置到 Green Lake 的行走路线规划。Displays a map with turn-by-turn walking directions to Green Lake from your current location.

下载离线地图Download offline maps

ms-settings: URI 方案可使你直接启动到“设置”应用中的特定页面。The ms-settings: URI scheme lets you launch directly into a particular page in the Settings app. 尽管 ms-settings: URI 方案不会启动到“地图”应用中,但它允许你直接启动到“设置”应用中的“离线地图”页面,并显示下载“地图”应用所使用的离线地图的确认对话框。While the ms-settings: URI scheme doesn't launch into the Maps app, it does allow you to launch directly to the Offline Maps page in the Settings app and displays a confirmation dialog to download the offline maps used by the Maps app. URI 方案接受由纬度和经度指定的点,并自动确定是否存在可用于包含该点的离线地图。The URI scheme accepts a point specified by a latitude and longitude and automatically determines if there are offline maps available for a region containing that point. 如果经过的纬度和经度恰好落在多个下载区域内,确认对话框将让用户选取要下载其中哪一个区域。If the latitude and longitude passed happen to fall within multiple download regions, the confirmation dialog will let the user pick which of those regions to download. 如果离线地图不适用于包含该点的区域,则“设置”应用中的“离线地图”页面将显示一个错误对话框。If offline maps are not available for a region containing that point, the offline Maps page in the Settings app is displayed with an error dialog.

示例 URISample URI 结果Results
ms-settings:maps-downloadmaps?latlong=47.6,-122.3ms-settings:maps-downloadmaps?latlong=47.6,-122.3 将“设置”应用打开到显示确认对话框的“离线地图”页面,以便下载包含指定经纬度点的区域的地图。Opens the Settings app to the Offline Maps page with a confirmation dialog displayed to download maps for the region containing the specified latitude-longitude point.

bingmaps: 参数引用bingmaps: parameter reference

此表中每个参数的语法都是通过使用扩展的巴科斯范式 (ABNF) 显示的。The syntax for each parameter in this table is shown by using Augmented Backus–Naur Form (ABNF).

参数Parameter 定义Definition ABNF 定义和示例ABNF Definition and Example 详细信息Details

cpcp

中心点Center point

cp = "cp=" cpvalcp = "cp=" cpval

cpval = degreeslat "~" degreesloncpval = degreeslat "~" degreeslon

degreeslat = \["-"\] 1*3DIGIT \["." 1*7DIGIT\]degreeslat = ["-"] 1*3DIGIT ["." 1*7DIGIT]

degreeslon = \["-"\] 1*2DIGIT \["." 1*7DIGIT]degreeslon = ["-"] 1*2DIGIT ["." 1*7DIGIT]

示例:Example:

cp=40.726966~-74.006076cp=40.726966~-74.006076

这两个值都必须采用十进制度数表示,并由波形符 (~) 分隔。Both values must be expressed in decimal degrees and separated by a tilde(~).

有效的经度值范围为 -180 到 +180(包括这两者)。Valid longitude values are between -180 and +180 inclusive.

有效的纬度值范围为 -90 到 +90(包括这两者)。Valid latitude values are between -90 and +90 inclusive.

bbbb

边界框Bounding box

bb = "bb=" southlatitude " _" westlongitude "~" northlatitude "_ " eastlongitudebb = "bb=" southlatitude "_" westlongitude "~" northlatitude "_" eastlongitude

southlatitude = degreeslatsouthlatitude = degreeslat

northlatitude = degreeslatnorthlatitude = degreeslat

westlongitude = degreeslonwestlongitude = degreeslon

eastlongitude = degreesloneastlongitude = degreeslon

degreeslat = ["-"] 13DIGIT ["." 17DIGIT]degreeslat = ["-"] 13DIGIT ["." 17DIGIT]

degreeslon = ["-"] 12DIGIT ["." 17DIGIT]degreeslon = ["-"] 12DIGIT ["." 17DIGIT]

示例:Example:

bb=39.719_-74.52~41.71_-73.5bb=39.719_-74.52~41.71_-73.5

用于指定边界框的矩形区域,采用十进制度数表示,使用波形符 (~) 来区分左下角和右上角。A rectangular area that specifies the bounding box expressed in decimal degrees, using a tilde (~) to separate the lower left corner from the upper right corner. 各个矩形区域的经纬度由下划线 (_) 分隔。Latitude and longitude for each are separated with an underscore (_).

有效的经度值范围为 -180 到 +180(包括这两者)。Valid longitude values are between -180 and +180 inclusive.

有效的纬度值范围为 -90 到 +90(包括这两者)。Valid latitude values are between -90 and +90 inclusive.

当提供边界框时,将忽略 cp 和 lvl 参数。The cp and lvl parameters are ignored when a bounding box is provided.

wherewhere

位置Location

where = "where=" wherevalwhere = "where=" whereval

whereval = 1 *( ALPHA / DIGIT / "-" / "." / "_" / pct-encoded / "!" / "$" / "'" / "(" / ")" / "* " / "+" / "," / ";" / ":" / "@" / "/" / "?")whereval = 1 *( ALPHA / DIGIT / "-" / "." / "_" / pct-encoded / "!" / "$" / "'" / "(" / ")" / "*" / "+" / "," / ";" / ":" / "@" / "/" / "?")

示例:Example:

where=1600%20Pennsylvania%20Ave,%20Washington,%20DCwhere=1600%20Pennsylvania%20Ave,%20Washington,%20DC

特定位置、路标或地点的搜索词。Search term for a specific location, landmark or place.

q

查询词Query Term

q = "q="q = "q="

wherevalwhereval

示例:Example:

q=mexican%20restaurantsq=mexican%20restaurants

本地商家或商家类别的搜索词。Search term for local business or category of businesses.

lvllvl

缩放级别Zoom Level

lvl = "lvl=" 12DIGIT \["." 12DIGIT\]lvl = "lvl=" 12DIGIT ["." 12DIGIT]

示例:Example:

lvl=10.50lvl=10.50

定义地图视图的缩放级别。Defines the zoom level of the map view. 有效值介于 1 至 20 之间,其中 1 表示缩到最小。Valid values are 1-20 where 1 is zoomed all the way out.

stysty

样式Style

sty = "sty=" ("a" / "r"/"3d")sty = "sty=" ("a" / "r"/"3d")

示例:Example:

sty=asty=a

定义地图样式Defines the map style. 此参数的有效值包括:Valid values for this parameter include:

  • a:借助地图显示鸟瞰图。a: Display an aerial view of the map.
  • r:借助地图显示街景图。r: Display a road view of the map.
  • 3d:借助地图显示 3D 视图。3d: Display a 3D view of the map. 可与 cp 参数结合使用,也可以与 rad 参数结合使用。Use in conjunction with the cp parameter and optionally with the rad parameter.

在 Windows 10 中,鸟瞰图和 3D 视图样式相同。In Windows 10, the aerial view and 3D view styles are the same.

请注意  省略sty参数将产生与 sty = r 相同的结果。 Note  Omitting the sty parameter produces the same results as sty=r.
 

rad>rad

半径Radius

rad = "rad=" 1\*8DIGITrad = "rad=" 1\*8DIGIT

示例:Example:

rad=1000rad=1000

一个圆形区域,可指定所需的地图视图。A circular area that specifies the desired map view. 半径值以米为单位进行测量。The radius value is measured in meters.

pitpit

PitchPitch

pit = "pit=" pitchpit = "pit=" pitch

示例:Example:

pit=60pit=60

指示查看地图的角度,其中 90 是水平查看(最大),0 是俯视查看(最小)。Indicates the angle that the map is viewed at, where 90 is looking out at the horizon (maximum) and 0 is looking straight down (minimum).

有效的俯仰值范围为 0 到 90(包括这两者)。Valid pitch values are between 0 and 90 inclusive.

hdghdg

方位Heading

hdg = "hdg=" headinghdg = "hdg=" heading

示例:Example:

hdg=180hdg=180

指示以角度表示的地图前进方向,其中 0 或 360 = 北、90 = 东、180 = 南和 270 = 西。Indicates the direction the map is heading in degrees, where 0 or 360 = North, 90 = East, 180 = South, and 270 = West.

汇总ss

街景Streetside

ss = "ss=" BITss = "ss=" BIT

示例:Example:

ss=1ss=1

指示在 ss=1 时所显示的街景图像。Indicates that street-level imagery is shown when ss=1. 省略 ss 参数将产生与 ss=0 相同的结果。Omitting the ss parameter produces the same result as ss=0. 通过与 cp 参数结合使用,指定街道级视图的位置。Use in conjunction with the cp parameter to specify the location of the street-level view.

请注意  街道级别的图像在所有区域中均不可用。 Note  Street-level imagery is not available in all regions.
 

trfctrfc

路况Traffic

trfc = "trfc=" BITtrfc = "trfc=" BIT

示例:Example:

trfc=1trfc=1

指定地图上是否包含路况信息。Specifies whether traffic information is included on the map. 省略 trfc 参数将产生与 trfc=0 时相同的结果。Omitting the trfc parameter produces the same results as trfc=0.

请注意,  流量数据在所有区域中都不可用。 Note  Traffic data is not available in all regions.
 

rtprtp

路线Route

rtp = "rtp=" (waypoint "~" [waypoint]) / ("~" waypoint)rtp = "rtp=" (waypoint "~" [waypoint]) / ("~" waypoint)

waypoint = ("pos."waypoint = ("pos." point ) / ("adr."point ) / ("adr." whereval)whereval)

point = "point."point = "point." pointval ["_" title]pointval ["_" title]

pointval = degreeslat "" degreeslonpointval = degreeslat "" degreeslon

degreeslat = ["-"] 13DIGIT ["." 17DIGIT]degreeslat = ["-"] 13DIGIT ["." 17DIGIT]

degreeslon = ["-"] 12DIGIT ["." 17DIGIT]degreeslon = ["-"] 12DIGIT ["." 17DIGIT]

title = wherevaltitle = whereval

whereval = 1( ALPHA / DIGIT / "-" / "." / "_" / pct-encoded / "!" / "$" / "'" / "(" / ")" / "" / "+" / "," / ";" / ":" / "@" / "/" / "?")whereval = 1( ALPHA / DIGIT / "-" / "." / "_" / pct-encoded / "!" / "$" / "'" / "(" / ")" / "" / "+" / "," / ";" / ":" / "@" / "/" / "?")

示例:Examples:

rtp=adr.Mountain%20View,%20CA~adr.SFOrtp=adr.Mountain%20View,%20CA~adr.SFO

rtp=adr.One%20Microsoft%20Way,%20Redmond,%20WA~pos.45.23423_-122.1232 _My%20Picnic%20Spotrtp=adr.One%20Microsoft%20Way,%20Redmond,%20WA~pos.45.23423_-122.1232_My%20Picnic%20Spot

定义要在地图上绘制的路线起点和终点,由波形符 (~) 分隔。Defines the start and end of a route to draw on the map, separated by a tilde (~). 每个经过点可能是通过使用纬度和经度的位置定义的,也可能是通过可选标题或地址标识符定义的。Each of the waypoints is defined by either a position using ltitude, longitude, and optional title or an address identifier.

一条完整的路线正好包含两个经过点。A complete route contains exactly two waypoints. 例如,包含两个经过点的路线由 rtp="A"~"B" 定义。For example, a route with two waypoints is defined by rtp="A"~"B".

还可以指定不完整的路线。It's also acceptable to specify an incomplete route. 例如,你可以仅定义包含 rtp="A"~ 的路线起点。For example, you can define only the start of a route with rtp="A"~. 在此情况下,显示路线输入时将在出发地字段中带有所提供的经过点,并且目的地字段具有焦点。In this case, the directions input is displayed with the provided waypoint in the From field and the To field has focus.

如果指定路线终点,与 rtp=~"B" 相同,路线面板上的目的地字段中将显示所提供的经过点。If only the end of a route is specified, as with rtp=~"B", the directions panel is displayed with the provided waypoint in the To field. 如果提供精确的当前位置,当前位置将预先填写在具有焦点的出发地字段中。If an accurate current location is available, the current location is pre-populated in the From field with focus.

如果给出一条不完整的路线,则不会绘制任何路线。No route line is drawn when an incomplete route is given.

通过与 mode 参数结合使用,指定交通的模式(驾车、公交或步行)。Use in conjunction with the mode parameter to specify the mode of transportation (driving, transit, or walking). 如果未指定 mode,将使用交通首选项的用户的模式提供路线。If mode isn't specified, directions will be provided using the user's mode of transportation preference.

请注意  标题可用于某个位置(如果该位置由pos参数值指定)。 Note  A title can be used for a location if the location is specified by the pos parameter value. 将显示标题,而不是显示纬度和经度。Rather than showing the latitude and longitude, the title will be displayed.
 

modemode

交通模式Transportation mode

mode = "mode=" ("d" / "t" / "w")mode = "mode=" ("d" / "t" / "w")

示例:Example:

mode=dmode=d

定义交通模式。Defines the transportation mode. 此参数的有效值包括:Valid values for this parameter include:

  • d:显示驾车路线的路线概述d: Displays route overview for driving directions
  • t:显示公交路线的路线概述t: Displays route overview for transit directions
  • w:显示步行路线的路线概述w: Displays route overview for walking directions

针对交通路线与 rtp 参数结合使用。Use in conjunction with the rtp parameter for transportation directions. 如果未指定 mode,将使用交通首选项的用户的模式提供路线。If mode isn't specified, directions will be provided using the user's mode of transportation preference. 在提供 mode 时,可以不提供任何路线参数用于为该模式输入从当前位置的路线输入。A mode can be provided with no route parameter to enter directions input for that mode from the current location.

集合collection

集合Collection

collection = "collection="(name"~"/)point["~"point]collection = "collection="(name"~"/)point["~"point]

name = "name."name = "name." wherevalwhereval

whereval = 1( ALPHA / DIGIT / "-" / "." / "_" / pct-encoded / "!" / "$" / "'" / "(" / ")" / "" / "+" / "," / ";" / ":" / "@" / "/" / "?")whereval = 1( ALPHA / DIGIT / "-" / "." / "_" / pct-encoded / "!" / "$" / "'" / "(" / ")" / "" / "+" / "," / ";" / ":" / "@" / "/" / "?")

point = "point."point = "point." pointval ["_" title]pointval ["_" title]

pointval = degreeslat "" degreeslonpointval = degreeslat "" degreeslon

degreeslat = ["-"] 13DIGIT ["." 17DIGIT]degreeslat = ["-"] 13DIGIT ["." 17DIGIT]

degreeslon = ["-"] 12DIGIT ["." 17DIGIT]degreeslon = ["-"] 12DIGIT ["." 17DIGIT]

title = wherevaltitle = whereval

示例:Example:

collection=name.My%20Trip%20Stops~point.36.116584_-115.176753_Las%20Vegas~point.37.8268_-122.4798_Golden%20Gate%20Bridgecollection=name.My%20Trip%20Stops~point.36.116584_-115.176753_Las%20Vegas~point.37.8268_-122.4798_Golden%20Gate%20Bridge

要添加到地图和列表的点的集合。Collection of points to be added to the map and list. 可以使用 name 参数命名点集合。The collection of points can be named using the name parameter. 使用纬度、经度和可选标题指定点。A point is specified using a latitude, longitude, and optional title.

用波形符 (~) 分隔名称和多个点。Separate name and multiple points with tildes (~).

如果你指定的项目中包含波形符,请确保已将该波形符编码为 %7EIf the item you specify contains a tilde, make sure the tilde is encoded as %7E. 如果不带有“中心点”和“缩放级别”参数,则集合将提供最佳地图视图。If not accompanied by Center point and Zoom Level parameters, the collection will provide the best map view.

重要提示 如果你指定的项目中包含下划线,请确保将该下划线双编码为 %255F。Important If the item you specify contains an underscore, make sure the underscore is double encoded as %255F.

 

ms-drive-to: 参数引用ms-drive-to: parameter reference

用于启动逐向导航驾驶路线请求的 URI 无需编码,并且具有以下格式。The URI to launch a request for turn-by-turn driving directions does not need to be encoded and has the following format.

注意 不在此 URI 方案中指定起点。Note You don’t specify the starting point in this URI scheme. 起点将始终假定为当前位置。The starting point is always assumed to be the current location. 如果你需要指定不同于当前位置的起点,请参阅显示路线和路况If you need to specify a starting point other than the current location, see Display directions and traffic.

 

参数Parameter 定义Definition 示例Example 详细信息Details
目标纬度destination.latitude 目的地纬度Destination latitude 示例:destination.latitude=47.6451413797194Example: destination.latitude=47.6451413797194 目的地的纬度。The latitude of the destination. 有效的纬度值范围为 -90 到 +90(包括这两者)。Valid latitude values are between -90 and +90 inclusive.
目标经度destination.longitude 目的地经度Destination longitude 示例:destination.longitude=-122.141964733601Example: destination.longitude=-122.141964733601 目的地的经度。The longitude of the destination. 有效的经度值范围为 -180 到 +180(包括这两者)。Valid longitude values are between -180 and +180 inclusive.
destination.namedestination.name 目的地的名称Name of the destination 示例:destination.name=Redmond, WAExample: destination.name=Redmond, WA 目的地的名称。The name of the destination. 你无需编码 destination.name 值。You do not have to encode the destination.name value.

 

ms-walk-to: 参数引用ms-walk-to: parameter reference

用于启动逐向导航步行路线请求的 URI 无需编码,并且具有以下格式。The URI to launch a request for turn-by-turn walking directions does not need to be encoded and has the following format.

注意 不在此 URI 方案中指定起点。Note You don’t specify the starting point in this URI scheme. 起点将始终假定为当前位置。The starting point is always assumed to be the current location. 如果你需要指定不同于当前位置的起点,请参阅显示路线和路况If you need to specify a starting point other than the current location, see Display directions and traffic.  

参数Parameter 定义Definition 示例Example 详细信息Details
目标纬度destination.latitude 目的地纬度Destination latitude 示例:destination.latitude=47.6451413797194Example: destination.latitude=47.6451413797194 目的地的纬度。The latitude of the destination. 有效的纬度值范围为 -90 到 +90(包括这两者)。Valid latitude values are between -90 and +90 inclusive.
目标经度destination.longitude 目的地经度Destination longitude 示例:destination.longitude=-122.141964733601Example: destination.longitude=-122.141964733601 目的地的经度。The longitude of the destination. 有效的经度值范围为 -180 到 +180(包括这两者)。Valid longitude values are between -180 and +180 inclusive.
destination.namedestination.name 目的地的名称Name of the destination 示例:destination.name=Redmond, WAExample: destination.name=Redmond, WA 目的地的名称。The name of the destination. 你无需编码 destination.name 值。You do not have to encode the destination.name value.

ms-settings: 参数引用ms-settings: parameter reference

ms-settings: URI 方案的地图应用特定参数的语法定义如下。The syntax for maps app specific parameters for the ms-settings: URI scheme is defined below. maps-downloadmaps 采用 ms-settings:maps-downloadmaps? 的形式与 ms-settings: URI 一起指定以指示脱机地图设置页。maps-downloadmaps is specified along with the ms-settings: URI in the form of ms-settings:maps-downloadmaps? to indicate the offline maps settings page. 

参数Parameter 定义Definition 示例Example 详细信息Details
经纬度latlong 定义离线地图区域的点。Point defining offline map region. 示例:latlong=47.6,-122.3Example: latlong=47.6,-122.3 geopoint 由逗号分隔的纬度和经度指定。The geopoint is specified by a comma separated latitude and longitude. 有效的纬度值范围为 -90 到 +90(包括这两者)。Valid latitude values are between -90 and +90 inclusive. 有效的经度值范围为 -180 到 +180(包括这两者)。Valid longitude values are between -180 and +180 inclusive.