Stefan //
Search for data 9,744 datasets and counting!
What is Infochimps?
Infochimps is an open catalog and marketplace for the world's data. You can share, sell, curate, and download data about anything and everything.
Some interesting data sets
...more data sets
- Retrosheet: Ballpark Data by Major League Baseball franchise
- GeoNames.org Postal Code files - US Zip Code Geolocations
- 50 Largest Metropolitan Statistical Areas--Population by Race and Hispanic Origin: 2006
- Social Security--Beneficiaries, Annual Payments, and Average Monthly Benefit, and by State and Other
- MySpace User Activity Stream: Word count by hour from December 2009-March 2010
- Twitter Census - Conversation Metrics: One year of URLs, Hashtags, Smileys usage (Smiley Counts)
Infochimps has data on any topic!
Top tags:
Infochimps is the place to find data online. We have data of any size, shape or format. You can sell data at a price and license you set, or share open data for free. We're the best source for bulk social network data such as Twitter and MySpace. We have tons of big data.
Try our bookmarklet!
Drag this link: Infochimp! to your bookmarks folder, and click it when you spot a ripe data banana.
You'll have to be a registered user to use it, so please take a second and sign on up while you're here.
Learn more about how you can help Catalog the World's Structured Data
Externalized PHP Strings Performance for Internationalization - SQLITE Anyone?
October 26, 2005
I just got started down the road of interationalizing our core enterprise product and I have to admit, I'm scared shitless. :)
After getting training for 4 days on everything you must take into account its staggering how much work needs to be done to internationalize a product. Things that need to be taken into consideration:
- Table Column length - if your tables are formatted for english only you're going to have a problem when german comes around and needs to expand by 40%. Is your app ready to have all the text in the gui expanded by at least 40%?
- Text in images - A no no if you want to have localization turned around in a reasonable amount of time. Imaging redoing all your graphics in every language you want to support? yikes. So replace those text in images with just text and maybe a nice background image.
- String Matching - You cannot do anything with strings anymore :) no more strstr, str_replace, preg_match's without unicode character support. How do you know what strings will be coming in? String length? Some japanese characters have 3 bytes in a character, strlen will just return the number 3 however its only one character. For this you'll need MBSTRING extension since PHP does not support multibyte chars natively (PHP6 will in the next couple of YEARS).
- Inline CSS/Hardcoded Markup - have bold tags all over? lose em. Bold in Japanese does nothing but leave the text unreadable, Have small fonts? You'll need to at least support 10pt fonts and 13pt line height to allow for japanese/chinese height expansion. You can externalize your bold tags using a span with a css class called bold <span class="bold"> Also all fonts must be externalized to a localizable CSS file because ARIAL or VERDANA fonts do not support japanese or chinese characters
- Unfair claims - in Germany for example its illegal to claim a product is "the best" or "the fastest" IE "My script is the fastest PHP script of its kind"
- Externalize those strings! - No hardcoded strings can be found in your HTML or PHP code, they must be replaced from a strings file that can be sent out to a translator.
- Security Questions - not everyone has a favorite basketball team, or social security #, or a favorite football team so think about common things in all countries if you're going to ask someone a question to remember their password
- But they're just pictures! - The seemingly innocent thumbs-up gesture is offensive in Australia, a picture of your hand making a "hitchhiking" sign will get your ass kicked in Nigeria, showing your hand like a stop sign is offensive in greece on the same scale as giving someone the finger.
- Concatination - root of all evil. A Simple String like
1
which would echo out "Welcome, JimmyP" would be offensive in Japanese (Japanese readers expect the subject of this sentence to be at the start, not the end as well as not have -san at the end) and there is no way to externalize that so the proper way would be to do something like
1
$string = getString("welcomeUser");
where your string would be "Welcome, %USERNAME%" which can be sent to a translator and understood that this is a welcome message with a user name Variable.
So what is the best way to externalize your strings? I did some initial performance testing and this is what I've come up with so far:1. INI FILE - store all your strings in a .ini file such as welcomeMsg = "Hi There" which can be parsed with parse_ini_file()
2. Native PHP Arrays - store your strings in a .php file using $msg['welcomeMsg'] = "Hi There"; which can be just included as a native php array
3. XML Format - store your strings as <string code="welcomeMsg">Hi There</string> and parsed using php5's simpleXML
4. SQL LITE - storing your strings in a SQL lite DB per language and having a function wrapper for queries
the winner???
well in a test of 50,000, 10,000 and 1,000 string files #4 SQL LITE was FIVE times as fast as SimpleXML (2nd place) and something like 20 Times faster than parsing INI files.here are the #'s
== Testing Methods ==
Testing was done adding additional text on every 4th iteration to add more realistic string data contents such as 400 character strings every 4th element to mimic filesize and parsing time.
=== Native PHP Arrays ===
This test was done using a file containing php's native arrays
<BR>
Example: $msg['key'] = "value";
<pre>
1
<?PHP $msg['keyname0'] = "valueofstring0testinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielength"; $msg['keyname1'] = "valueofstring1"; $msg['keyname2'] = "valueofstring2"; $msg['keyname3'] = "valueofstring3"; ?>50,000 strings
.69
.68
.64
.59
.64
.6010,000 strings
.23
.23
.23
.21
.22=== XML File Format ===
Tested using an xml file that is parsed with php5's simplexml's methods for accessing strings<BR>
Example: <string key="key">value</value>
1
<?xml version="1.0" encoding="UTF-8" ?> - <strings> <string key="key0">valueofstring0testinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielength</string> <string key="key1">valueofstring1</string> <string key="key2">valueofstring2</string> <string key="key3">valueofstring3</string> <string> </strings>
<BR>
50,000 strings.32 sec
.34 sec
.37 sec
.41 sec
.38 sec10,000 strings
.14 sec
.15 sec
.15 sec
.07 sec
.15 sec1,000 strings
.01 sec
.01 sec
.01 sec
.01 sec
.01 sec=== INI FILE TYPE ===
Parsing .ini files using the parse_ini_file method in PHP
[php]
key0 ="valueofstring0testinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielengthtestinglongerstringsinthisfileforgoodiegoodielength"
key1 ="valueofstring1"
key2 ="valueofstring2"
key3 ="valueofstring3"
[/php50,000 strings
.68
.65
.63
.60
.6510,000 strings
.21
.22
.22
.18
.211,000 strings
.02
.02
.02
.02
.02SQL LITE--------------
Got a little tip from Wez Furlong about SQLITE in PHP5 and boy was he right, using SQLITE on 50,000 strings, picking out the strings you needed took a teeeeeny tiny .07 seconds!
This post was posted on October 26, 2005 in the following sections: PHP. There are currently 27 comments.
-->Comments
RSS feed for comments on this post.
The URI to TrackBack this entry is: http://www.litfuel.net/plush/bblog/trackback.php/84/-->
timvw says:
November 3, 2005 @ 00:31 — ReplyHave you had a look at http://www.php.net/gettext?
Jim says:
November 4, 2005 @ 01:06 — Replyyep, but we dismissed it after a few trials. It wasn't working for our needs so we needed a custom solution to work with our translation teams overseas.
Max Barel says:
July 23, 2006 @ 15:40 — ReplyIf this thread is still alive, can you elaborate on why gettext did't fill your needs? I plan to use it and don't want to miss the point.
Amit Gupta says:
November 6, 2005 @ 10:23 — Replyhow about MySQL for storing Unicode characters? MySQL does support unicode chars using the unicode collation as well as several language specific collations!! PS:- which syntax hiliting plugin are you using? its broken in several places, if you just take a look, you'll know!!
Elliot Anderson says:
November 13, 2005 @ 08:08 — Reply"The seemingly innocent thumbs-up gesture is offensive in Australia" ... Im an Aussie and I have never heard that before.
Shawn says:
November 22, 2005 @ 08:33 — Replygreat article. may just have to implement this in one of my big projects. '"The seemingly innocent thumbs-up gesture is offensive in Australia" ... Im an Aussie and I have never heard that before.' .. Ditto
Jim says:
November 22, 2005 @ 19:38 — Replyreally you guys haven't heard of that one? maybe they got the country wrong then.
Anonymous says:
February 13, 2006 @ 15:22 — ReplyThere are some custom scripts you may use for UTF-8 encoding. See http://cms.naczasie.pl/lgpl/UTF-8.php, find DOWNLOAD and click :)
Bruce Sauls says:
May 28, 2010 @ 21:17 — ReplyComment pending moderation
Ben says:
April 14, 2006 @ 23:55 — ReplyHi, informative article, thanks. Just thought I'd point out what appears to be a mistake, for the benefit of future googlers. In your second code example, you have 'echo getString("welcomeUser");' but I think you mean 'echo $value;'.
Mgccl says:
June 19, 2007 @ 23:13 — ReplyJust how can you access those strings in XML? I mean, once you convert the XML file into simpleXML objects, what would you do to find the key and return the string?
speps says:
July 1, 2007 @ 15:49 — Reply@Mgccl : see the PHP documentation for SimpleXMLElement->xpath() and maybe you will need to find doc about XPath too (google or wikipedia).
Web developers says:
August 21, 2009 @ 16:49 — ReplyHumm... interesting, If this thread is still alive, can you elaborate on why gettext did't fill your needs? I plan to use it and don't want to miss the point. Thanks
blu ray ripper says:
April 18, 2010 @ 10:53 — ReplyComment pending moderation
Hollywood Wallpapers says:
April 19, 2010 @ 01:32 — ReplyComment pending moderation
Aditya Yadav says:
May 12, 2010 @ 06:14 — ReplyComment pending moderation
642-062 says:
May 19, 2010 @ 07:52 — ReplyComment pending moderation
shopping says:
May 21, 2010 @ 12:17 — ReplyComment pending moderation
HID lights says:
May 23, 2010 @ 10:25 — ReplyComment pending moderation
fat burning furnace scam says:
June 1, 2010 @ 16:34 — ReplyComment pending moderation
virbram five fingers says:
June 5, 2010 @ 03:14 — ReplyComment pending moderation
coach outlet says:
June 7, 2010 @ 08:53 — ReplyComment pending moderation
Billig Stromlieferant says:
June 7, 2010 @ 12:27 — ReplyComment pending moderation
links of london says:
June 8, 2010 @ 01:36 — ReplyComment pending moderation
MKV to iPad says:
June 9, 2010 @ 07:50 — ReplyComment pending moderation
LOuIs VuItToN Damier Graphite Canvas says:
June 10, 2010 @ 05:16 — ReplyComment pending moderation
Jany Robert says:
June 11, 2010 @ 10:35 — ReplyComment pending moderation
Leave a Comment
Line and paragraph breaks automatic, HTML allowed:
<a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <code> <em> <i> <strike> <strong>
/^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9]([-a-z0-9_]?[a-z0-9])*(\.[-a-z0-9_]+)*\.(aero|arpa|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro|travel|mobi|[a-z]{2})|([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})(\.([1]?\d{1,2}|2[0-4]{1}\d{1}|25[0-5]{1})){3})(:[0-9]{1,5})?$/i
http://blog.tuxz.net/archives/2009/03/27/email_validation_using_regular_expression/
Uses preg_match()Valid: 18/19
Invalid: 17/18
The Google Places API (Developer Preview)
The Google Places API will launch in July, 2010. Please consult this preview documentation for details on how the service works. To use this API, you must satisfy our Acceptable Use Requirements.
Note: To use the Google Places API you must first request a Maps API client ID and cryptographic key which you must use to sign your request URLs. For information on signing URL requests, please see the URL Authentication documentation within the Web Service APIs home page.
Introduction
The Google Places API is a service that returns information about a "place" (hereafter referred to as a Place) — defined within this API as an establishment, a geographic location, or prominent point of interest — using an HTTP request. Place requests specify locations as latitude/longitude coordinates.
Two basic Place requests are available: a Place Search request and a Place Details request. Generally, a Place Search request is used to return candidate matches, while a Place Details request returns more specific information about a Place.
This service is designed for processing place requests generated by a user for placement of application content on a map; this service is not designed to respond to batch of offline queries, which are a violation of its terms of use.
Audience
This document is intended for website and mobile developers who want to add local business and point of interest information within maps provided by one of the Google Maps APIs. It provides an introduction to using the API and reference material on the available parameters.
Acceptable Use Requirements
To obtain access to this API, users must agree to the following acceptable use guidelines and fill out an official application form:
- Applications using the service must comply with the Google Maps API Terms of Service.
- All developers wishing to use the service must already have an Adsense account, or must create one prior to applying.
- Applications that wish to use the API must only issue queries in response to end user actions.
- The results of every search made by applications using this API must be shown to a user.
- Place Details requests must only be made in response to user interaction with place Search results, or to refresh the details of a previously requested Place. It is not permitted for an application to iterate over all Search results to obtain details for every result.
- Applications may not reorder or manipulate Search results.
- Applications must display any branding or sponsorship of search results returned by the API.
- Applications may not store any Place data permanently except References and IDs.
- If screen size constraints prevent a map being shown with search or details results the Powered by Google logo must be shown.
- Place information collected using this API, or any data derived from it, such as Place location corrections, can not be distributed in any way, such as through an API, without the express permission of Google.
The Places API will launch in July, 2010. The documentation contained here is a developer preview. Developers wishing to use the Place API should fill out a Places API Application Form.
A more complete and detailed set of requirements will be documented closer to launch, and these listed requirements (and the documentation) may change in future. Notifications of such changes will be sent to the relevant Google Group.
Usage Limits
Query limits for the Google Places API will be set closer to launch and may be specific to each application depending on the use case and traffic estimates
Note: the Places API may only be used in conjunction with displaying results on a Google map; using Place data without displaying a map for which Place data was requested is prohibited. Additionally, calculation of Place information may generate copyrights, warnings and/or advertising which must be displayed to the user in some fashion.
Place Searches
The Places API has two types of requests, which are related: Place Search requests and Place Details requests. A Place Search request initiates a request for "places" around a provided location, often provided via geolocation (so that a user can search for the Place they are currently located or Places nearby). The Places API returns a list of candidate places that are near the provided location and the user can then initiate a Place Details request on a specific entity returned in the original search.
Place Search Request
A Place Search request is an HTTP URL of the following form:
1 http://maps.google.com/maps/api/place/search/output?parameterswhere
outputmay be either of the following values:
json(recommended) indicates output in JavaScript Object Notation (JSON)xmlindicates output as XMLCertain parameters are required to initiate a Place Search request. As is standard in URLs, all parameters are separated using the ampersand (
&) character. The list of parameters and their possible values are enumerated below.
location(required) — The textual latitude/longitude value from which you wish to retrieve place information.radius(required) — The distance (in meters) within which to return Place results.sensor(required) — Indicates whether or not the Place request came from a device using a location sensor (e.g. a GPS) to determine the location sent in this request. This value must be eithertrueorfalse.client(required) — Specifies the registered application using this service.signature(required) — The generated value of signing this URL using the client's cryptographic key. (See URL Authentication for more information.)Place Search Responses
Place Search responses are returned in the format indicated by the
outputflag within the URL request's path.Place Search JSON Output
A sample JSON Place Search request is shown below, asking for places for about a mile around Williamsburg, Brooklyn:
1 http://maps.google.com/maps/api/place/search/json?location=40.717859,-73.957790&radius=1600&client=clientId&sensor=true_or_false&signature=SIGNATUREThe JSON response is shown below. (Note that Places API
referenceelements have been shortened for clarity. Additionally, the full array ofresultshas been shortened.1 { "status": "OK", "results": [ { "name": "Williamsburg", "types": [ "locality", "political" ], "icon": "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png", "reference": "ClRBAAAAXP...lHAPyHom2aG" }, { "name": "Greenpoint", "vicinity": "New York", "types": [ "neighborhood", "political" ], "icon": "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png", "reference": "CkQ_AAAAhd...MF45fwr44Ek" }, { "name": "Peter Luger Steakhouse", "vicinity": "Broadway, Brooklyn", "types": [ "restaurant", "food", "establishment" ], "icon": "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", "reference": "ClRCAAAAt3...6Nt7k11iQdT" }, { "name": "Music Hall of Williamsburg", "vicinity": "North 6th Street, Brooklyn", "types": [ "establishment" ], "icon": "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png", "reference": "ClRFAAAAN...6UOKCbjv7Sxy" }, ...additional results ... ], "html_attributions": [ ]}The JSON response contains three root elements:
"status"contains metadata on the request. See Status Codes below."results"contains an array of places, with information about the place. See Place Search Results for information about these results. The Places API returns up to 20establishmentresults. Additionally,politicalresults may be returned which serve to identify the area of the request.html_attributionscontain a set of attributions about this listing which must be displayed to the user.Of particular interest within the results are the
referenceelements, which can be used to request more specific details about the establishment via a separate query. These references are temporary and expire after 15 minutes. (See Place Details Requests below.)Note that these results generally need to be parsed if you wish to extract values from the results. Parsing JSON is relatively easy. See Parsing JSON for some recommended design patterns.
Place Search XML Output
You may optionally request XML results within a Place Search request using the
/xmloutput flag. A sample XML request is shown below, performing an identical Place Search request as shown in the JSON example above:1 http://maps.google.com/maps/api/place/search/xml?location=40.717859,-73.9577937&radius=1600&client=clientId&sensor=true_or_false&signature=SIGNATUREThe XML returned by this request is shown below.
1 <PlaceSearchResponse> <status>OK</status> <result> <name>Williamsburg</name> <type>locality</type> <type>political</type> <icon>http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png</icon> <reference>CkRAAAAAUhZG...Yy0b4-sd1zCUu9P8</reference> </result> <result> <name>Greenpoint</name> <vicinity>New York</vicinity> <type>neighborhood</type> <type>political</type> <icon>http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png</icon> <reference>CkQ-AAAAHIDo...nYmSR8l52FmkMH6c</reference> <name>Peter Luger Steakhouse</name> <vicinity>Broadway, Brooklyn</vicinity> <type>restaurant</type> <type>food</type> <type>establishment</type> <icon>http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png</icon> <reference>ClRBAAAATIpR...mHSxoyiRcr_FVuww</reference> </result> ...additional results...</PlaceSearchResponse>Note that the XML response consists of a single
<PlaceSearchResponse>and two top-level elements:
<status>contains metadata on the request. See Status Codes below.- Zero of more
<result>elements, each containing information about a single establishment. See Place Search Results for information about these results. The Places API returns up to 20establishmentresults. Additionally,political<type>results, or streets, may be returned which serve to identify the area of the request.html_attributionscontain a set of attributions about this listing which must be displayed to the user.We recommend that you use
jsonas the preferred output flag unless your application requiresxmlfor some reason. Processing XML trees requires some care, so that you reference proper nodes and elements. See Parsing XML with XPath for some recommended design patterns for output processing.The remainder of this documentation will use JSON syntax. In most cases, the output format does not matter for purposes of illustrating concepts or field names in the documentation. However, note the following subtle differences:
- XML results are wrapped in a root
<PlaceSearchResponse>element.- JSON denotes entries with multiple elements by plural arrays (
results), while XML denotes these using multiple singular elements (<result>).- Blank elements are indicated through empty arrays in JSON, but by the absence of any such element in XML. A response that generates no results will return an empty
resultsarray in JSON, but no<result>elements in XML, for example.Status Codes
The
"status"field within the Place Search response object contains the status of the request, and may contain debugging information to help you track down why the Place Search request failed. The"status"field may contain the following values:
"OK"indicates that no errors occurred; the place was successfully detected and at least one result was returned."ZERO_RESULTS"indicates that the search was successful but returned no results. This may occur if the search was passed alatlngin a remote location."OVER_QUERY_LIMIT"indicates that you are over your quota."REQUEST_DENIED"indicates that your request was denied, generally because of lack of asensorparameter."INVALID_REQUEST"generally indicates that the query parameter (locationorradius) is missing.Place Search Results
When the Places service returns results from a search, it places them within a (JSON)
resultsarray. Even if the service returns no results (such as if thelocationis remote) it still returns an emptyresultsarray. (XML responses consist of zero or more<result>elements.)Each element of the
resultsarray contains a single result from the specifiedlocationand within the specifiedradius, ordered by prominence. The result may also contain attribution information which must be displayed to the user.Each result within the
resultsfield may contain the following fields:
namecontains the human-readable name for the returned result. Forestablishmentresults, this is usually the business name.vicinitycontains a feature name of a nearby location. Often this feature refers to a street or neighborhood within the given results. This vicinity can be used to further refine results or disambiguate similar results.types[]contains an array of feature types describing the given result.iconcontains the URL of a recommended icon which may be displayed to the user when indicating this result.referencecontains a unique time-sensitive token that you can use to retrieve additional information about this place in a Place Details request. Currently, this token is valid for 15 minutes from the original search request.Place Details
Once you have a
referencefrom a Place Search request, you can request more details about a particular establishment or point of interest by initiating a Place Details request. A Place Details request returns more comprehensive information about the indicated place such as its complete address, phone number, user rating, etc.Place Details requests should be made in response to the selection of a search result by a user. You may not use a Place Details request to request details for all results returned by a search before they are presented to the user.
Place Details Requests
A Place Details request is an HTTP URL of the following form:
1 http://maps.google.com/maps/api/place/details/output?parameterswhere
outputmay be either of the following values:
json(recommended) indicates output in JavaScript Object Notation (JSON)xmlindicates output as XMLCertain parameters are required to initiate a search request. As is standard in URLs, all parameters are separated using the ampersand (
&) character. The list of parameters and their possible values are enumerated below.
reference(required) — The textual identifier uniquely identifying a place. Thus reference ID will either be a temporary value returned from a Place search request or a permanent value stored from a previous Place Details request.Place Details Responses
Place Details responses are returned in the format indicated by the
outputflag within the URL request's path.Place Details JSON Output
A sample JSON request is shown below, calculating Place Details requests for a particular establishment:
1 http://maps.google.com/maps/api/place/details/json?reference=REFERENCE_ID&client=clientId&sensor=true_or_false&signature=SIGNATUREThe JSON response is shown below. (Note that the Places API
referenceID has been shortened for clarity.1 { "status": "OK", "result": { "name": "Peter Luger Steakhouse", "vicinity": "Broadway, Brooklyn", "types": [ "restaurant", "food", "establishment" ], "formatted_phone_number": "(718) 387-7400", "formatted_address": "178 Broadway, Brooklyn, New York 11211, United States", "address_components": [ { "long_name": "178", "short_name": "178", "types": [ "street_number" ] }, { "long_name": "Broadway", "short_name": "Broadway", "types": [ "route" ] }, { "long_name": "Brooklyn", "short_name": "Brooklyn", "types": [ "locality", "political" ] }, { "long_name": "Kings", "short_name": "Kings", "types": [ "administrative_area_level_2", "political" ] }, { "long_name": "New York", "short_name": "New York", "types": [ "administrative_area_level_1", "political" ] }, { "long_name": "11211", "short_name": "11211", "types": [ "postal_code" ] } ], "geometry": { "location": { "lat": 40.7099090, "lng": -73.9625800 } }, "rating": 3.7, "url": "http://maps.google.com/maps/place?cid=11421630699047551449", "icon": "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png", "reference": "CkQ6AAAA03...hONadGmZ0", "id": "ddf9cee27322c3bf" }, "html_attributions": [ ]}The JSON response contains three root elements:
"status"contains metadata on the request. See Status Codes below."result"contains the detailed information about the place requested. See Place Details Results for information about these results.html_attributionscontain a set of attributions about this listing which must be displayed to the user.See Parsing JSON for some recommended design patterns.
Place Details XML Output
You may optionally request XML results within a Place Details request using the
/xmloutput flag. A sample XML request is shown below, performing an identical Place Details request as shown in the JSON example above:1 http://maps.google.com/maps/api/place/details/xml?reference=REFERENCE_ID&client=clientId&sensor=true_or_false&signature=SIGNATUREThe XML returned by this request is shown below.
1 <PlaceDetailsResponse> <status>OK</status> <result> <name>Peter Luger Steakhouse</name> <vicinity>Broadway, Brooklyn</vicinity> <type>restaurant</type> <type>food</type> <type>establishment</type> <formatted_phone_number>(718) 387-7400</formatted_phone_number> <formatted_address>178 Broadway, Brooklyn, New York 11211, United States</formatted_address> <address_component> <long_name>178</long_name> <short_name>178</short_name> <type>street_number</type> </address_component> <address_component> <long_name>Broadway</long_name> <short_name>Broadway</short_name> <type>route</type> </address_component> <address_component> <long_name>Brooklyn</long_name> <short_name>Brooklyn</short_name> <type>locality</type> <type>political</type> </address_component> <address_component> <long_name>Kings</long_name> <short_name>Kings</short_name> <type>administrative_area_level_2</type> <type>political</type> </address_component> <address_component> <long_name>New York</long_name> <short_name>New York</short_name> <type>administrative_area_level_1</type> <type>political</type> </address_component> <address_component> <long_name>11211</long_name> <short_name>11211</short_name> <type>postal_code</type> </address_component> <geometry> <location> <lat>40.7099090</lat> <lng>-73.9625800</lng> </location> </geometry> <rating>3.7</rating> <url>http://maps.google.com/maps/place?cid=11421630699047551449</url> <icon>http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png</icon> <reference>CkQ6AAAAd...4oT4Sof9RHoGD4</reference> <id>ddf9cee27322c3bf</id> </result> </PlaceDetailsResponse>Note that the XML response consists of a single
<PlaceDetailsResponse>and three top-level elements:
<status>contains metadata on the request. See Status Codes below.- A single
<result>element containing detailed information about a single establishment. See Place Details Results for information about these results.<html_attributions>contain a set of attributions which must be displayed to the user.See Parsing XML with XPath for some recommended design patterns for output processing.
Status Codes
The
"status"field within the Place response object contains the status of the request, and may contain debugging information to help you track down why the Place request failed. The"status"field may contain the following values:
"OK"indicates that no errors occurred; the place was successfully detected and at least one result was returned."ZERO_RESULTS"indicates that the reference was valid but no longer refers to a valid result. This may occur if the establishment is no longerin business."OVER_QUERY_LIMIT"indicates that you are over your quota."REQUEST_DENIED"indicates that your request was denied, generally because of lack of asensorparameter."INVALID_REQUEST"generally indicates that the query (reference) is missing or expired.Place Details Results
When the Places service returns results from a details request, it places them within a single
result. Each result may contain the following fields:
namecontains the human-readable name for the returned result. Forestablishmentresults, this is usually the canonicalized business name.vicinitycontains a feature name of a nearby location. Often this feature refers to a street or neighborhood within the given results. This vicinity can be used to further refine results or disambiguate similar results.types[]contains an array of feature types describing the given result. See Place Feature Types for more information.formatted_phone_numbercontains a human-readable phone number.
formatted_addressis a string containing the human-readable address of this place. Often this address is equivalent to the "postal address," which sometimes differs from country to country. (Note that some countries, such as the United Kingdom, do not allow distribution of true postal addresses due to licensing restrictions.) This address is generally composed of one or more address components. For example, the address "111 8th Avenue, New York, NY" contains separate address components for "111" (the street number, "8th Avenue" (the route), "New York" (the city) and "NY" (the US state). These address components contain additional information as noted below.
address_components[]is an array of separate address components used to compose a given address. For example, the address "111 8th Avenue, New York, NY" contains separate address components for "111" (the street number, "8th Avenue" (the route), "New York" (the city) and "NY" (the US state). Eachaddress_componenttypically contains:
types[]is an array indicating the type of the address component.long_nameis the full text description or name of the address component as returned by the Geocoder.short_nameis an abbreviated textual name for the address component, if available. For example, an address component for the state of Alaska may have along_nameof "Alaska" and ashort_nameof "AK" using the 2-letter postal abbreviation.
geometrycontains the following information:
locationcontains the geocoded latitude,longitude value for this place.urlcontains the official Google Place Page URL of this establishment, which must be linked to from the Place's name when displaying this Place to the user.ratingcontains the average user rating for this establishment based on the reviews shown on Google Maps, which are provided by a number of Google partners and websites.iconcontains the URL of a suggested icon which may be displayed to the user when indicating this result on a mapreferencecontains a permanent token about this place. Note that unlike areferencereturned in a Place Search request, this reference token is stable and does not expire. However, although this token uniquely identifies the place, the converse is not true: a place may have many valid reference tokens.idcontains a unique stable identifier denoting this place. This identifier may not be used to retrieve information about this place, but this id is guaranteed to be valid across sessions, so you can use it to consolidate data about this place, and verify the identity of a Place across separate searches.
CloudMade Makes Maps Differently
CloudMade helps you make the most of map data. We source our maps from OpenStreetMap, the community mapping project which is making a free map of the world. Our aim is to continue the democratization of geo data and to expand access to open geo data through a range of simple yet powerful tools and APIs.
Our tools and APIs allow developers to create rich interactive experiences on the web and mobile.
Find out moreCloudMade Wins 'Best Emerging Startup' at Mobile World Congress
Latest Blog Entries
CloudMade Services Are Now Free – Sign Up Today
If you are a mobile or web developer – we have good news! As of today, when you sign up for a CloudMade developer account all of our services will be free of charge and will let you make money with loca...
© 2008-2010 CloudMade. Map data © 2010 OpenStreetMap.org contributors Terms and Conditions Privacy Policy