Monday, September 21, 2015

Google Places "Type" Dropdown list (Free HTML Code)

I've been working on a new venture named GoPage (www.gopage.com).  As part of our lookup through the Google Places API, we need to pass over the "type" parameter. The Google Places API is a REST based API that uses the URI to control facets of the returned data.  The type is added in based on the taxonomy containing over one hundred different types of locations expressed here.

The request is made by issuing the following post:

https://maps.googleapis.com/maps/api/place/radarsearch/json?location=48.859294,2.347589&radius=5000&types=food|cafe&keyword=vegetarian&key=API_KEY
The types=value parameter is shown in blue.  If you find yourself wanting to implement this in an HTML drop down list, you will not find that code on the internet (as I did not) and face the tedious task of having to write it yourself.  Well, today is your lucky day. Here is the code done for you. Now you have time to do something else (like play video games) and tell your boss you worked hard to copy and paste all 100 types into the HTML source.

Have fun!

(Remember to paste this as Plain Text and change the form action to your own code)

</form action="form_processor.php">
<select name="type">
<!-- Based on Google Types as of 2015-09-21
     First value is selected by default. If selected, no type should be written into the API -->
<option value="" selected="selected">Any</option>
<option value="accounting">Accounting</option>
<option value="airport">Airport</option>
<option value="amusement_park">Amusement_park</option>
<option value="aquarium">Aquarium</option>
<option value="art_gallery">Art_gallery</option>
<option value="atm">Atm</option>
<option value="bakery">Bakery</option>
<option value="bank">Bank</option>
<option value="bar">Bar</option>
<option value="beauty_salon">Beauty_salon</option>
<option value="bicycle_store">Bicycle_store</option>
<option value="book_store">Book_store</option>
<option value="bowling_alley">Bowling_alley</option>
<option value="bus_station">Bus_station</option>
<option value="cafe">Cafe</option>
<option value="campground">Campground</option>
<option value="car_dealer">Car_dealer</option>
<option value="car_rental">Car_rental</option>
<option value="car_repair">Car_repair</option>
<option value="car_wash">Car_wash</option>
<option value="casino">Casino</option>
<option value="cemetery">Cemetery</option>
<option value="church">Church</option>
<option value="city_hall">City_hall</option>
<option value="clothing_store">Clothing_store</option>
<option value="convenience_store">Convenience_store</option>
<option value="courthouse">Courthouse</option>
<option value="dentist">Dentist</option>
<option value="department_store">Department_store</option>
<option value="doctor">Doctor</option>
<option value="electrician">Electrician/option>
<option value="electronics_store">Electronics_store</option>
<option value="embassy">Embassy</option>
<option value="establishment">Establishment</option>
<option value="finance">Finance</option>
<option value="fire_station">Fire_station</option>
<option value="florist">Florist</option>
<option value="food">Food</option>
<option value="funeral_home">Funeral_home"</option>
<option value="furniture_store">Furniture_store</option>
<option value="gas_station">Gas_station</option>
<option value="general_contractor">General_contractor</option>
<option value="grocery_or_supermarket">Grocery_or_supermarket</option>
<option value="gym">Gym</option>
<option value="hair_care">Hair_care</option>
<option value="hardware_store">Hardware_store</option>
<option value="health">Health</option>
<option value="hindu_temple">Hindu_temple</option>
<option value="home_goods_store">Home_goods_store</option>
<option value="hospital">Hospital</option>
<option value="insurance_agency">Insurance_agency</option>
<option value="jewelry_store">Jewelry_store</option>
<option value="laundry">Laundry</option>
<option value="lawyer">Lawyer</option>
<option value="library">Library</option>
<option value="liquor_store">Liquor_store</option>
<option value="local_government_office">Local_government_office</option>
<option value="locksmith">Locksmith</option>
<option value="lodging">Lodging</option>
<option value="meal_delivery">Meal_delivery</option>
<option value="meal_takeaway">Meal_takeaway</option>
<option value="mosque">Mosque</option>
<option value="movie_rental">Movie_rental</option>
<option value="movie_theater">Movie_theater</option>
<option value="moving_company">Moving_company</option>
<option value="museum">Museum</option>
<option value="night_club">Night_club</option>
<option value="painter">Painter</option>
<option value="park">Park</option>
<option value="parking">Parking</option>
<option value="pet_store">Pet_store</option>
<option value="pharmacy">Pharmacy</option>
<option value="physiotherapist">Physiotherapist</option>
<option value="place_of_worship">Place_of_worship</option>
<option value="plumber">Plumber</option>
<option value="police">Police</option>
<option value="post_office">Post_office</option>
<option value="real_estate_agency">Real_estate_agency</option>
<option value="restaurant">Restaurant</option>
<option value="roofing_contractor">Roofing_contractor</option>
<option value="rv_park">Rv_park</option>
<option value="school">School</option>
<option value="shoe_store">Shoe_store</option>
<option value="shopping_mall">Shopping_mall</option>
<option value="spa">Spa</option>
<option value="stadium">Stadium</option>
<option value="storage">Storage</option>
<option value="store">Store</option>
<option value="subway_station">Subway_station</option>
<option value="synagogue">Synagogue</option>
<option value="taxi_stand">Taxi_stand</option>
<option value="train_station">Train_station</option>
<option value="travel_agency">Travel_agency</option>
<option value="university">University</option>
<option value="veterinary_care">Veterinary_care</option>
<option value="zoo">Zoo</option>
</select>
<input type="submit" value="Submit">
</form>

No comments:

Post a Comment

Do not spam this blog! Google and Yahoo DO NOT follow comment links for SEO. If you post an unrelated link advertising a company or service, you will be reported immediately for spam and your link deleted within 30 minutes. If you want to sponsor a post, please let us know by reaching out to duane dot nickull at gmail dot com.