使用地址详细信息调用 Blackberry Map 应用程序

发布于 2024-10-30 22:44:51 字数 474 浏览 2 评论 0原文

我正在使用 4.6 版本的黑莓操作系统。

我尝试使用以下命令调用地图应用程序:

Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(MapsArguments.ARG_LOCATION_DOCUMENT, document));

这对于示例文档来说效果很好,例如:

            String document = "<lbs>" + "<location lon='-8030000' lat='4326000' label='Kitchener, ON' description='Kitchener, Ontario, Canada' />" + "</lbs>";

我的问题是:如果我不知道我要检查的位置的坐标,如何构建这样的文档?我只知道地址...

I am working with version 4.6 of the blackberry OS.

I am attempting to invoke the Maps application using the following:

Invoke.invokeApplication(Invoke.APP_TYPE_MAPS, new MapsArguments(MapsArguments.ARG_LOCATION_DOCUMENT, document));

This works fine for an example document such as:

            String document = "<lbs>" + "<location lon='-8030000' lat='4326000' label='Kitchener, ON' description='Kitchener, Ontario, Canada' />" + "</lbs>";

My question is: how can I construct such a document if I do not know the coordinates of the location I am trying to inspect? I only know the address...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走野 2024-11-06 22:44:51

根据此文档支持地址、城市、邮政编码和区域属性。这行得通吗?

如果这不起作用,您需要使用 Locator 类来获取位置信息。但它需要起始坐标。 文档第 25 页的代码:

// Create an javax.microedition.location.AddressInfo  object
AddressInfo ai = new AddressInfo();

// Set the fields of the AddressInfo Object
ai.setField(AddressInfo.STREET, “main street”);
ai.setField(AddressInfo.CITY, “Toronto”);
ai.setField(AddressInfo.STATE, “Ontario”);
ai.setField(AddressInfo.POSTAL_CODE, “XXX XXX”);
ai.setField(AddressInfo.COUNTRY, “Canada”);

// Create a Coordinates object that the location-based services locator server
//   uses as a starting location to search for location 
//   information for an address.
Coordinates co = new Coordinates(45.423488, -75.697929, 0);

// Create a Locator object.
Locator lo = new Locator();

// Invoke Locator.geocode(AddressInfo address, Coordinates startCoords).
Enumeration en = lo.geocode(ai, co);

According to this document, <location> supports an address, city, postal code, and region attributes. Would this work?

If that doesn't work, you'll need to use the Locator class to get the location information. It needs starting coordinates though. Code from page 25 of the documentation:

// Create an javax.microedition.location.AddressInfo  object
AddressInfo ai = new AddressInfo();

// Set the fields of the AddressInfo Object
ai.setField(AddressInfo.STREET, “main street”);
ai.setField(AddressInfo.CITY, “Toronto”);
ai.setField(AddressInfo.STATE, “Ontario”);
ai.setField(AddressInfo.POSTAL_CODE, “XXX XXX”);
ai.setField(AddressInfo.COUNTRY, “Canada”);

// Create a Coordinates object that the location-based services locator server
//   uses as a starting location to search for location 
//   information for an address.
Coordinates co = new Coordinates(45.423488, -75.697929, 0);

// Create a Locator object.
Locator lo = new Locator();

// Invoke Locator.geocode(AddressInfo address, Coordinates startCoords).
Enumeration en = lo.geocode(ai, co);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文