如何在Google Maps Android API v2中沿我的路线加油站

问题描述 投票:2回答:3

我有一个在起点和终点之间绘制路线的应用程序。我需要在这条路线上标记加油站。我已经阅读了Google Places API。您能告诉我在这种情况下如何使用Places API吗?

android google-maps-android-api-2 google-places-api
3个回答
2
投票

首先您需要google map api密钥。您可以从google获得一个。this link。现在,当您拥有api键时...您可以使用它来使用以下方法获得所需的位置this linkhttps://maps.googleapis.com/maps/api/place/nearbysearch/json?location=Your_Latitude,Your_Longitude&radius=In_Metres&types=What_You_Want_To_Search&key=Your_API_KEY

以及关于场所类型的支持。.结帐this link

快乐编码:)


0
投票

您可以在此进行分类搜索。您可以在]中了解详细知识>

https://developers.google.com/maps/documentation/android/intents

[如果您通过常规搜索词,则Google Maps将尝试在您指定的经纬度附近找到与您的条件相符的位置。如果未指定位置,则Google Maps将尝试查找附近的列表。例如:

// Search for restaurants nearby
Uri gmmIntentUri = Uri.parse("geo:0,0?q=restaurants");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);


// Search for restaurants in San Francisco
Uri gmmIntentUri = Uri.parse("geo:37.7749,-122.4194?q=restaurants");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);

您可以对加油站进行类似操作


0
投票

检查this教程。您可能会发现这很有帮助

© www.soinside.com 2019 - 2024. All rights reserved.