経由でテキストから道路の位置を取得しますが、テキストは、道路や道路注射することを目指しています。私は座標に変換する必要がフリーテキストを持っているGoogleマップAPI
問題では、GoogleのAPIジオコーディングサービスは近くの建物を返すが、私は道路themselfsが必要だということです。例えば
: ラスベガスでUS95と日没を検索する
{
"results" : [
{
"address_components" : [
{
"long_name" : "U.S. 95",
"short_name" : "US-95",
"types" : [ "route" ]
},
{
"long_name" : "Whitney Ranch",
"short_name" : "Whitney Ranch",
"types" : [ "neighborhood", "political" ]
},
{
"long_name" : "Henderson",
"short_name" : "Henderson",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Clark County",
"short_name" : "Clark County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Nevada",
"short_name" : "NV",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "89014",
"short_name" : "89014",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "US-95 & W Sunset Rd, Henderson, NV 89014, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 36.0636796,
"lng" : -115.0334434
},
"southwest" : {
"lat" : 36.0632289,
"lng" : -115.033988
}
},
"location" : {
"lat" : 36.0635045,
"lng" : -115.0336492
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 36.0648032302915,
"lng" : -115.0323667197085
},
"southwest" : {
"lat" : 36.0621052697085,
"lng" : -115.0350646802915
}
}
},
"partial_match" : true,
"place_id" : "ChIJf0Azwu_QyIARci-cUiUBGMg",
"types" : [ "route" ]
},
{
"address_components" : [
{
"long_name" : "U.S. 95",
"short_name" : "US-95",
"types" : [ "route" ]
},
{
"long_name" : "Henderson",
"short_name" : "Henderson",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Clark County",
"short_name" : "Clark County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Nevada",
"short_name" : "NV",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "89011",
"short_name" : "89011",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "US-95 & W Sunset Rd, Henderson, NV 89011, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 36.0616173,
"lng" : -115.029007
},
"southwest" : {
"lat" : 36.0591372,
"lng" : -115.0301591
}
},
"location" : {
"lat" : 36.0603734,
"lng" : -115.0295973
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 36.0617262302915,
"lng" : -115.0282340697085
},
"southwest" : {
"lat" : 36.0590282697085,
"lng" : -115.0309320302915
}
}
},
"partial_match" : true,
"place_id" : "ChIJmZvnMeTQyIARi5giBwp9Ylc",
"types" : [ "route" ]
},
{
"address_components" : [
{
"long_name" : "U.S. 95",
"short_name" : "US-95",
"types" : [ "route" ]
},
{
"long_name" : "Whitney Ranch",
"short_name" : "Whitney Ranch",
"types" : [ "neighborhood", "political" ]
},
{
"long_name" : "Henderson",
"short_name" : "Henderson",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Clark County",
"short_name" : "Clark County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Nevada",
"short_name" : "NV",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "89014",
"short_name" : "89014",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "US-95 & W Sunset Rd, Henderson, NV 89014, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 36.065207,
"lng" : -115.0334417
},
"southwest" : {
"lat" : 36.0648819,
"lng" : -115.0334889
}
},
"location" : {
"lat" : 36.065045,
"lng" : -115.0334589
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 36.06639343029149,
"lng" : -115.0321163197085
},
"southwest" : {
"lat" : 36.0636954697085,
"lng" : -115.0348142802915
}
}
},
"partial_match" : true,
"place_id" : "ChIJ5bnQNO7QyIAReqWyr22kKYc",
"types" : [ "route" ]
},
{
"address_components" : [
{
"long_name" : "U.S. 95",
"short_name" : "US-95",
"types" : [ "route" ]
},
{
"long_name" : "Midway",
"short_name" : "Midway",
"types" : [ "neighborhood", "political" ]
},
{
"long_name" : "Henderson",
"short_name" : "Henderson",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Clark County",
"short_name" : "Clark County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Nevada",
"short_name" : "NV",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "89011",
"short_name" : "89011",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "US-95 & W Sunset Rd, Henderson, NV 89011, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 36.0631541,
"lng" : -115.0303368
},
"southwest" : {
"lat" : 36.0628498,
"lng" : -115.0303404
}
},
"location" : {
"lat" : 36.063002,
"lng" : -115.0303386
},
"location_type" : "GEOMETRIC_CENTER",
"viewport" : {
"northeast" : {
"lat" : 36.0643509302915,
"lng" : -115.0289896197085
},
"southwest" : {
"lat" : 36.0616529697085,
"lng" : -115.0316875802915
}
}
},
"partial_match" : true,
"place_id" : "ChIJAzrYiuXQyIARIZcbN66ts10",
"types" : [ "route" ]
}
],
"status" : "OK"
}
を返しますが、私は必要な本当の座標は以下のとおりです。36.063761 -115.032024。
道路座標を取得するにはどのように何かアドバイスは?私はあなたがそう
https://developers.google.com/maps/faq#geocoder_highways
に見つけることができることをフォーマットする米国の道路のために以下の推奨を示唆している
あなたの例では、最初のアイテムのタイプは「ルート」です。ビルドされていません。位置は、ジオコーダツール(https://google-developers.appspot.com/maps/documentation/utils/geocoder/#q%3D36.063505%252C-115.033649)で確認できます。この例は期待どおりに動作しているようです。 – xomena
はい、希望の座標は結果から除外されます –