How to get place description from Google Places API - google-maps

I am trying to use the Google places API to get information on certain places. I have an
example from Google search:
here of what I am trying to find. I thought that the "types" field of the Places API text search would contain it, but this text appears to be different and not within the provided list of options. If anyone can provide some info on where this comes from and how to obtain it, it would be much appreciated. Thanks

Currently you cannot obtain this data via Places API. There is a feature request in Google issue tracker to make the detailed business type available in Places API, however Google doesn't expose any ETA:
https://issuetracker.google.com/issues/35822953
Feel free to star this feature request to express your interest and subscribe to notification from Google.

According to Google Places SDK to Android:
Since September 24, 2015 we have:
This release adds three new methods to AutocompletePrediction, giving you easy access to the primary and secondary parts of the place description as well as the full text of the description. This is useful, for example, when you want to display a short title followed by further detail about the place. See the sample code on GitHub. The new methods are as follows:
getFullText(CharacterStyle matchStyle) returns the full text of a place description. This is a combination of the primary and secondary text. Example: "Eiffel Tower, Avenue Anatole France, Paris, France".
This method is equivalent to the existing getDescription() method. In addition, it lets you highlight the sections of the description that match the search with a style of your choice, using CharacterStyle. The CharacterStyle parameter is optional. Set it to null if you don't need any highlighting.
getPrimaryText(CharacterStyle matchStyle) returns the main text describing a place. This is usually the name of the place. Examples: "Eiffel Tower", and "123 Pitt Street".
getSecondaryText(CharacterStyle matchStyle) returns the subsidiary text of a place description. This is useful, for example, as a second line when showing autocomplete predictions. Examples: "Avenue Anatole France, Paris, France", and "Sydney, New South Wales".
Accompanying the above improvement, the following methods on AutocompletePrediction, are now deprecated:
getDescription() is now deprecated.
Please use getFullText(), getPrimaryText(), and/or getSecondaryText() to retrieve the full or partial description, getMatchedSubstrings() is now deprecated. Please use getFullText() to format matches more easily.

Related

Is it possible to narrow down to and only include specific words in search-function, Google maps API?

I´m going to build an interactive frontend webpage with a simple map-function. I will include 10 cities from a sustainable cities-list, to choose from in the search field. Now my question is, after you have chosen one of these cities from this search field - if it´s possible to build a list to choose from, with specific words to look for in the chosen city, for example instead of choosing "restaurants" or "accommodations", have words like "organic" or "eco". My hope is that this word search will find all the places in the city with the e.g word "organic" in it, like "The organic market" or "Organic food-store" and so on. Is there a function where I can narrow down the search for these specific words in a list of like 15 by me pre-chosen words, and that this will not include all the possible imaginable words in the world, in this search field? - but instead exclude all the other words than my pre-chosen ones like "organic" or "eco" etc?
-Also, is the Google maps API best for this, or Google-places API?
Using Places API's Text Search, you can search for keywords/text string and the API will return a list of places matching the text string and any location bias that you will set.
For client-side implementation, please refer to this guide: https://developers.google.com/maps/documentation/javascript/places#TextSearchRequests
Hope this helps!

How to read one column texts with Google Cloud Vision API

I have the next document image
When I try to convert the image to text, the result is the next:
Top Text
Ref: Rad: Dte: Ddo:
Ejecutivo 76520400300 Banco de Bogotá Luz Adriana
Botton Text
The problem is Google API recongnize it like two columns so, How can I config the Google API in order to obtain one column text?
My goal is obtain:
Top Text
Ref:Ejecutivo Rad: 76520400300 Dte: Banco de Bogotá Ddo:Luz Adriana
Botton Text
Google team member responded that Document AI works better than Cloud Vision as per the update on the issue
Cloud Vision API doesn't have a specific request property to specify the format used to read or sort the file's data. Instead, I think that the available workaround is to use the BoundingPoly and Vertex response properties, that display the coordinates related to each word contained in the image, in order to process the vertices data within your code logic and define the text that need to be grouped by columns and rows. You can take a look on this link which includes some response examples that include these properties.
In case this feature doesn't cover your current needs, you can use the Send Feedback button, located at the lower left and upper right corners of the service public documentation, as well as take a look the Issue Tracker tool in order to raise a Vision API feature request and notify to Google about this desired functionality.

Google Places/Maps API - Quick Facts Text?

I'm trying to figure out if Google Places (or Maps) API allows me to request the 'Quick Facts' text shown when you search for a city/town on Google Maps. For example, if you search for 'London on Google Maps on desktop, brings back this text in a panel on the left side of the page:
"London, England’s capital, set on the River Thames, is a 21st-century city with history stretching back to Roman times. At its centre stand the imposing Houses of Parliament, the iconic ‘Big Ben’ clock tower and Westminster Abbey, site of British monarch coronations. Across the Thames, the London Eye observation wheel provides panoramic views of the South Bank cultural complex, and the entire city."
I know I can get 'description text' back for actual places using Google Places API but I don't think this is the case for towns and cities themselves. Does anyone know how I can get this 'quick facts' text for cities/towns using an API?
You can use the SaveWidget control to create a custom UI for saving places. When you use the SaveWidget you can specify additional attribution data so that you user remembers where they saved the place from and can easily navigate back to your app.
In order to add a SaveWidget to your app, you will need to do the following:
Add a div to a page that contains a Google Map.
Indicate the place to be saved with a marker, so that your user knows which place they are saving.
Create a SaveWidgetOptions object that includes a place and attribution object literal.
Create a new SaveWidget object, passing the div and the options that you've added.
Follow this link to show the complete code sample: https://developers.google.com/maps/documentation/javascript/examples/save-widget

Google maps query parameter clarification

I am implementing a feature in the website where I take the location of the users via 5 input boxes and then need to show location in the google maps,
I know this process is called geocoding but again after doing some search I came across this link,
http://www.seomoz.org/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
This link tells that we can pass location as query string parameters to google map's url.
Is this process valid and is their any restriction on its usage this way
The place I have always gone for Google Maps query parameters was this mapki page. Creating a URL for google maps is directing your user to google's website, and is subject to the terms of use for google maps.
See the link in the original question, the mapki link is dead.
content from Google Map Parameters (note this referred to the original http://maps.google.com, not to the "new" google maps, looks like it might have been originally authored by Mike Williams):
Google Map Parameters
From Google Mapki (no longer live)
Here's a list of some of the parameters that can be passed to maps.google.com. You might want to pass such parameters if you want to get Google Maps to display driving directions, which are not available under the API.
q= Query - anything passed in the q parameter is treated as if it had been typed into the query box on the maps.google.com page. In particular:
a precise address is looked up and a marker and info box is displayed at the specified point
a town name, or the first half of a postcode causes the region to be displayed with to marker or info box
an exact location can be specified as latitude,longitude, in decimal form (52.123N,2.456W or 52.123,-2.456) or as degrees, minutes and seconds (52 7 22.8N,2 27 21.6W or 52 7 22.8,-2 27 21.6) or as degrees and minutes (52 7.38N,2 27.36W or 52 7.38,-2 27.36).
any text added in parentheses () is displayed in the info window and sidebar in bold, there appears to be no way to cause a line break, but you can use %A0 as a "no break space" to prevent line breaks happening where you don't want them.
the words "to" and "from" cause the driving directions function to be activated.
the word "near" or "loc:" causes the local search function to be activated
space-ampersand-space (use +%26+ or %20%26%20 in URLs, not +&+ or +&+ otherwise the ampersand gets treated as a separator) can be used between the names of two streets to specify an intersection.
A location can also be specified after an at sign, in decimal form (#52.123,-2.456). This gives a lower zoom level than using the same values without the at sign. Using this format interferes with other options of the query parameter. The # sign instead of "near" or "loc:" tends to cause only a single business result to be displayed, compare (Church near Hallows Road Blackpool, Lancashire) which returns over 1000 results to (Church # Hallows Road Blackpool, Lancashire) which returns one result.
The full URL of a Google Earth .KML/.KMZ file or a RSS feed that includes GeoRSS data, can be used, and the contained information will be displayed on the map.
ll= Latitude,longitude of map centre - Note the order. Only decimal format is accepted.
If this is used without a query, then the map is centred at the point but no marker or info window is displayed
sll= Latitude,longitude of the point from which the business search should be performed. You could use this to perform an off-centre busness search. Google use it so "link to this page" can record a map that has had the centre moved after performing a business search.
spn= Approximate lat/long span. The zoom level will be adjusted to fit if there's no &z parameter. Use this Mapki tool to find a lat and long.
sspn= ?? lat/long of... what?
hl= Host language - only a few languages are supported, e.g. &hl=fr for French.
t= Map Type. The available options are "m" map, "k" satellite, "h" hybrid
saddr= Source address. Use this when asking for driving directions
any text added in brackets is displayed in the sidebar in bold
daddr= Destination address(es). Use this when asking for driving directions
any text added in brackets is displayed in the sidebar in bold
"+to:" clauses can be appended to the destination to request multiple destination routing, like this "&dadr=Blackpool+to:Manchester+to:Leeds"
text in brackets can also be added to the "+to:" clauses.
mrad= Additional destination address.
If you've got three points in your trip you can use &saddr, &daddr and &mrad instead of "+to:" clauses.
start= Skips the first (start-1) matches
num= Display, at most, this number of matches. The valid range is 0 to 10 (but 0 is a bit pointless).
near= Can be used as the location part of a query instead of putting the whole thing into &q.
f= Controls the style of query form to be displayed. &f=d displays the "directions" form (two input boxes: from, to), &f=l displays the "local" form (two input boxes: what, where). Otherwise the default search form is displayed (single input).
output=html Uses the old style Google Local page format from before it merged with Google Maps, with the small map and large sidebar.
output=js Outputs JavaScript object literals and function calls used by Google Maps, including encoded polyline data for driving directions, and stage information in HTML format.
output=kml Outputs a KML file containing full Placemark information representing the current map.
output=nl Outputs a small KML file containing a NetworkLink wrapper linking to a URL from which Google Earth and Google Maps can obtain the Placemark information.
latlng= This is a weird one. It takes three numbers separated by commas. The first two numbers (presumably representing latitude and longitude multiplied by 1000000) are ignored. The third number seems to be a Google internal "Company ID" number for a particular business. E.g. &latlng=0,0,14944637421527611642 represents Blackpool Community Church. Specifying this parameter performs a Google Search for pages that reference that business, and displays a tiny map. Other parameters, in particular &q, must have valid contents (but need not relate to the target business) for this to work.
cid= Similar to latlng, but generating a different map size. It takes three numbers separated by commas. The first two numbers (presumably representing latitude and longitude multiplied by 1000000) are ignored. The third number seems to be a Google internal "Company ID" number for a particular business. E.g. &cid=0,0,14944637421527611642 represents Blackpool Community Church. Specifying this parameter displays a large map of the identified company location. Other parameters, in particular &q, must have valid contents (but need not relate to the target business) for this to work.
vp= The presence of this parameter causes maps.google.com to switch into Copyright Service mode. Instead of returning the html that draws a map, it returns information about the copyright ownership in Javascript format. The &vp parameter specifies the viewpoint (i.e. the centre of the map). Copyright Service only works when the &spn and &z parameters are also supplied, indicating the span and the zoom. Optional parameters are &t, which specifies the map type, and &key which specifies the API key of the site performing the request. E.g. http://maps.google.com/maps?spn=0.030372,0.068665&z=6&t=h&vp=53.859462,-3.038235
om= The presence of this parameter with a value other than 1 causes the overview map to be closed. If the parameter is omitted, or present with the value 1, then the overview map is open.
ie= Can be used to specify the character set. e.g. &ie=UTF8.
pw= Activates print mode and initiates printing. There seems to be a problem at the moment with &pw=1, but using settings like &pw=2 is OK.
z= Sets the zoom level.
iwloc= Specifies where the infowindow will be displayed. In a business search &iwloc=A to &iwloc=J will open the info window over the corresponding business marker, and &iwloc=near will place it over the big green arrow if that's currently displayed. &iwloc=addr can be used on map search to explicitly request the info window to be open on the address, but that's the default anyway. Directions search supports &iwloc=start, &iwloc=end and &iwloc=pause1 etc.
layer=t Activates the traffic overlay
msa=b Activates the "My Maps" sidebar when used in conjunction with "maps.google.com/ms". It does nothing without the "/ms" and "/ms" does nothing without the "&msa=b".
msa=0 Involved in My Maps processing. Possibly specifies the My Maps server number.
msid= Specifies a My Maps identifier. When used in conjunction with "maps.google.com/ms" and &msa=0, the corresponding My Map is displayed.
mrt=kmlkmz Skips the normal search and goes directly to User-Created Content. Only works if the query contains a location and something to search for. E.g. q=hotel&near=london&mrt=kmlkmz or q=hotel+in+london&mrt=kmlkmz.
view= Can be used to select text view (view=text) or the normal map view (view=map)
dirflg=h Switches on "Avoid Highways" route finding mode.
Retrieved from "http://mapki.com/wiki/Google_Map_Parameters"
Yes, it's valid, here is the Google documentation
which also covers usage limitations

What is a good API to use to determine the address of a place based on its name?

I need to get the specific address (or lat/long coordinates) of a place based on that place's name.
Specifically, I need to determine the location of supermarkets in a given area so that I can use those locations as 'markers' in my implementation of google maps static maps api.
Using the following, I can if you input a specific location in the area that currently says "INSERT_LOCATION_HERE", then you will get a google map of the specified area with markers at the locations.:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|INSERT_LOCATION_HERE&sensor=false
For example (the marker indicates the local Wegmans store based on its address:
http://maps.google.com/maps/api/staticmap?center=Ithaca,%20NY&size=512x512&maptype=roadmap&markers=color:blue|label:S|500%20So.%20Meadow%20Street&sensor=false
If anyone knows how to do this without using google maps places api, that would be extremely helpful!
If you want to get the name as a string intead of an image, you can do it with a little help for Google. That'll match nicely with the static map that you're using.
Let's say you want to search for "Den Haag"...
Construct a URL like this, and parse the result:
http://maps.google.com/maps/geo?q=den%20haag
You can also specify the output format:
http://maps.google.com/maps/geo?q=den%20haag&output=xml
http://maps.google.com/maps/geo?q=den%20haag&output=csv
http://maps.google.com/maps/geo?q=den%20haag&output=json
You can also provide coordinates instead of a name, and get a full name+coordinates in return:
http://maps.google.com/maps/geo?q=52.0467315,4.3796239&output=json
For some reason the links don't work when you click them from this page. I guess google doesn't accept a referrer in the request, so just copy and paste the links... That works.