Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Places API type airport

I'm building a website for a client in the transport industry and I'm using the Google Places API to acquire pickup location and destination. One requirement is to display a "Flight Number" field, if the pickup is an airport.

To work out whether an airport is coming back from the Google Maps API, we look at the location's "type" attribute.

This works for most cases, such as "Brisbane International Airport, Brisbane Airport, Queensland, Australia", but not for some other cases, such as "Brisbane Airport, Queensland, Australia".

Object {address_components: Array[3], adr_address: "<span class="locality">Brisbane Airport</span> <sp…pan>, <span class="country-name">Australia</span>", formatted_address: "Brisbane Airport QLD, Australia", geometry: Object, icon: "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png"…}
address_components: Array[3]
adr_address: "<span class="locality">Brisbane Airport</span> <span class="region">QLD</span>, <span class="country-name">Australia</span>"
formatted_address: "Brisbane Airport QLD, Australia"
geometry: Object
html_attributions: Array[0]
icon: "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png"
id: "80dd327e4dbee8d2ca0dcf65ebfb3c46cb3790ae"
name: "Brisbane Airport"
place_id: "ChIJo9DK_AHik2sR4IHe81qjAgU"
reference: "CpQBggAAACdy4sxtQDDCxp500sBAWHFCjZMLrRvG4X1Qc91zQdupccCLhTDteb5tTtxpPvQM9xVlXlF-mqmr27blvXYxx14w7fZFpi69pq63rk4OKCtnKMzpHXxPeT1j5xmqLEanQi4q09hhJZlwr6sk34PAphv4gxsOWQHB6RE_Zyoipxf43185HF3Sv3t4sw3K2p_9chIQMTmNyjRSLoL02xwqxx_YfRoUzAuVlz_nBa7LHYz1dflI1OZclcM"
scope: "GOOGLE"
types: Array[2]
0: "locality"
1: "political"
length: 2
__proto__: Array[0]
url: "https://maps.google.com/maps/place?q=Brisbane+Airport+QLD,+Australia&ftid=0x6b93e201fccad0a3:0x502a35af3de81e0"
vicinity: "Brisbane Airport"
__proto__: Object

My expectation would be for "airport" to appear in the "types" array for both "Brisbane International Airport, Brisbane Airport, Queensland, Australia" and "Brisbane Airport, Queensland, Australia".

Can anyone tell me why this isn't the case? Is this something to report to Google and get them to fix? If yes, how do I do that, considering the Google Places API (https://groups.google.com/forum/?hl=en#!forum/google-places-api) says I need to ask technical questions here?

ps: its kind of related to this post, but I haven't been able to find the answer in this one.

like image 535
user1687403 Avatar asked Mar 16 '26 12:03

user1687403


1 Answers

It's because you're finding a suburb named "Brisbane Airport", not the Brisbane airport.

https://en.wikipedia.org/wiki/Brisbane_Airport_%28suburb%29

If you filter for airport, you can be 99% certain you'll only get airports.

like image 196
Scott Avatar answered Mar 18 '26 11:03

Scott



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!