[WP8.1]如何在Windows应用商店8.1手机应用中集成地图 [英] [WP8.1]How to integrate Maps in Windows Store 8.1 Phone app

查看:64
本文介绍了[WP8.1]如何在Windows应用商店8.1手机应用中集成地图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要将地图集成到我的Windows应用中。能够整合地图并获得当前位置。陷入应用内的搜索功能并将位置设置为新(与UBER相同)。 Windows地图是否具有搜索地址的功能?

Need to integrate Maps into my windows app. Was able to integrate the map and get the current location. Stuck in search functionality inside app and setting the location to new (Same as UBER). Does Windows maps have the functionality to search for address?

如果是这样的话怎么样?找不到任何文件?

If so how? Couldn't find any documentation for it?

推荐答案

嗨prinzemathew,

Hi prinzemathew,

Welcome
to开发通用Windows应用程序论坛!

请阅读粘贴帖子,尤其是

发布指南:主题行标签

Windows 10 SDK和工具的已知问题 

Please read the sticky posts, especially the Guide to posting: subject line tags and Known Issues for Windows 10 SDK and Tools 

>>"能够整合地图并获取当前位置。"

>>" Was able to integrate the map and get the current location."

是的。您可以将MapControl集成到Windows Phone 8.1应用程序中,并使用
Geolocator
用于获取当前用户位置的API。

Yes. You could integrate MapControl in your windows phone 8.1 app and use Geolocator APIs to get current user’s position.

>>"Windows地图是否具有搜索地址的功能?"

>>" Does Windows maps have the functionality to search for address?"

您需要使用
MapLocationFinder
用于搜索特定地址的类。

You would need to use MapLocationFinder class to search the specific address.

var myPosition = await new Geolocator().GetGeopositionAsync(TimeSpan.FromMinutes(1), TimeSpan.FromSeconds(10));

            MapLocationFinderResult result =
      await MapLocationFinder.FindLocationsAsync("blue", myPosition.Coordinate.Point);
            if (result.Status == MapLocationFinderStatus.Success)
            {
                BasicGeoposition newLocation = new BasicGeoposition();
                newLocation.Latitude = result.Locations[0].Point.Position.Latitude;
                newLocation.Longitude = result.Locations[0].Point.Position.Longitude;
                Geopoint geoPoint = new Geopoint(newLocation);
                MapAddress mapAddress = result.Locations[0].Address;
                Debug.WriteLine(mapAddress.Town+mapAddress.Street+mapAddress.BuildingName+mapAddress.BuildingRoom);
                //if you want to focus on the new point
                mymap.Center = geoPoint;
            }


<Page
    x:Class="AppMap.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:AppMap"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:map="using:Windows.UI.Xaml.Controls.Maps"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

    <Grid>
        <map:MapControl x:Name="mymap" MapServiceToken="your map service token"></map:MapControl>
    </Grid>
</Page>

最好的问候,

Xavier Eoro

Xavier Eoro


这篇关于[WP8.1]如何在Windows应用商店8.1手机应用中集成地图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆