Free form text field to structured address fields - regex

Gmail/Contacts does a great job of parsing this address into specific address fields.
7 Prasad Road,
Narimedu, Madurai,
Tamil Nadu,
India
is accurately parsed to be:
Street: 7 Prasad Road
Neighborhood: Narimedu
City: Madurai
State/Province: Tamil Nadu,
Country: India
Is there anyway to use Google Maps Contacts API just to transform free text into address fields like this?
One more thing to note: This is for a non-profit. Not a commercial site.
I'm concerned about using Geocoding to approximate because we are working globally and Google Maps is not too accurate in finding the right location in some countries. I still don't want to lose information user has entered. Usually we need to be able to filter addresses by city and state so these need to parsed exactly. The rest of it should not be lost. With geocoding, I'm finding that it formats the address to remove the fields that it doesn't understand. In gmail contacts, it leaves that alone and parses what it is able to parse.
Thanks,
Safris
UPDATE:
Google maps api is able to pick up the neighborhood, city, state, country from what the user has typed. When I hit the api by doing this: http://maps.googleapis.com/maps/api/geocode/json?address=B19/F1%20Vigyanapuri,%20Vidyanagar,%20Hyd%20500044%20,India&sensor=false, it then returns back the following result:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Vigyanpuri Colony Park",
"short_name" : "Vigyanpuri Colony Park",
"types" : [ "point_of_interest", "establishment" ]
},
{
"long_name" : "APHB Colony",
"short_name" : "APHB Colony",
"types" : [ "neighborhood", "political" ]
},
{
"long_name" : "Adikmet",
"short_name" : "Adikmet",
"types" : [ "sublocality", "political" ]
},
{
"long_name" : "Hyderabad",
"short_name" : "HYD",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Hyderabad",
"short_name" : "Hyderabad",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Andhra Pradesh",
"short_name" : "Andhra Pradesh",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "India",
"short_name" : "IN",
"types" : [ "country", "political" ]
},
{
"long_name" : "500044",
"short_name" : "500044",
"types" : [ "postal_code" ]
}
],
"formatted_address" : "Vigyanpuri Colony Park, APHB Colony, Adikmet, Hyderabad, Andhra Pradesh 500044, India",
"geometry" : {
"location" : {
"lat" : 17.40368240,
"lng" : 78.51184130
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 17.41432930,
"lng" : 78.52784870000001
},
"southwest" : {
"lat" : 17.39303490,
"lng" : 78.49583389999999
}
}
},
"partial_match" : true,
"types" : [ "point_of_interest", "park", "establishment" ]
}
],
"status" : "OK"
}
But I'm just not sure how far to trust this - as far as I can tell, it seems accurate. I would like to take the address that user entered and parse it with google maps api and put it on a map approximately and have them correct me if I'm wrong. In Gmail/Contacts, I'm able to add address as a text field and it parses it by 'street address', whatever it couldn't parse, and then if it finds an accurate city, it puts it in, same with State/Province. I just wasn't sure how it is able to leave everything in street address, what it couldn't parse. Does Google's Contacts API allow us to use this without saving contacts to Google.
Thanks for looking into this!
Safris

Related

The BigQueryInsertJobOperator in Airflow does not create a table

I'm trying to setup an Airflow job that executes a BigQuery job by calling the BigQueryInsertJobOperator operator that should create a table to store the results of a query if it doesnt exist. The setup looks like this:
task3 = BigQueryInsertJobOperator(
task_id="item_data",
project_id="project_id",
configuration={
"jobType" : "QUERY",
"query" : {
"query" : "{% include 'sql_query.sql' %}",
"useLegacySql" : False
},
"tableDefinitions" : {
"fields" : [
{
"name" : "DEPT_NBR",
"type" : "INTEGER"
},
{
"name" : "ITEM_NBR",
"type" : "INTEGER"
},
{
"name" : "CREATED_DATE",
"type" : "STRING"
}
]
},
"destinationTable" : {
"projectId" : "project_id",
"datasetId" : "dataset_id",
"tableId" : "table_id"
},
"createDisposition" : "CREATE_IF_NEEDED",
"writeDisposition" : "WRITE_APPEND",
"priority" : "BATCH",
"schemaUpdateOptions" : [
"ALLOW_FIELD_ADDITION"
],
"timePartitioning" : {
"type" : "DAY",
"expirationMs" : 31556926000,
"field" : "CREATED_DATE"
},
"clustering" : {
"fields" : [
"DEPT_NBR"
]
}
},
impersonation_chain="svc-account#project_id.iam.gserviceaccount.com",
location="US" )
Everything executes perfectly but it does not create the table. When I check the logs, what I'm seeing is that it's storing the data in a temporary table with an expiration date of 24 hours and despite setting the priority to BATCH it's still running as INTERACTIVE. Any thoughts?
A level is missing in your configuration :
task3 = BigQueryInsertJobOperator(
task_id="item_data",
project_id="project_id",
configuration={
"query": {
"query": "{% include 'sql_query.sql' %}",
"useLegacySql": False,
"destinationTable": {
"projectId": "project_id",
"datasetId": "dataset_id",
"tableId": "table_id"
},
"createDisposition": "CREATE_IF_NEEDED",
"writeDisposition": "WRITE_APPEND",
"priority": "BATCH",
"schemaUpdateOptions": [
"ALLOW_FIELD_ADDITION"
],
"timePartitioning": {
"type": "DAY",
"expirationMs": 31556926000,
"field": "CREATED_DATE"
},
"clustering": {
"fields": [
"DEPT_NBR"
]
},
"tableDefinitions": {
"fields": [
{
"name": "DEPT_NBR",
"type": "INTEGER"
},
{
"name": "ITEM_NBR",
"type": "INTEGER"
},
{
"name": "CREATED_DATE",
"type": "STRING"
}
]
}
}
},
impersonation_chain="svc-account#project_id.iam.gserviceaccount.com",
location="US")
There is a parent node query and the other options are put inside.

Fetching "Special Hours" from Google Business

A Place Details response using the Google Places API only includes normal operating hours, not special hours. When you “download all locations” from the Google Business UI in CSV format, there is a row titled “special hours” with the data I want to retrieve. So I know it's there. See an example of this at the following published Google Sheet:
https://docs.google.com/spreadsheets/d/e/2PACX-1vR9lrELXbbiDw9QLeVEo-Ob6JH2hf5YuI2vRjQ9mPASMFfiXlLKPUSf98GkjN87h--y2f7DgVx0lFhE/pubhtml
Is it possible to retrieve “Special Hours” information from Google Business using the Google Places API Web Service or is this only possible by using the Google Business API?
A parameter titled "special hours" exists in the Google Business API Documentation.
//JSON example for a Place Details Response using Google Places API Web service
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "San Luis Obispo",
"short_name" : "San Luis Obispo",
"types" : [ "locality", "political" ]
},
{
"long_name" : "San Luis Obispo County",
"short_name" : "San Luis Obispo County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
},
{
"long_name" : "93407",
"short_name" : "93407",
"types" : [ "postal_code" ]
}
],
"adr_address" : "Building 65, 1 Grande Ave, \u003cspan class=\"street-address\"\u003eCalifornia Polytechnic State University\u003c/span\u003e, \u003cspan class=\"locality\"\u003eSan Luis Obispo\u003c/span\u003e, \u003cspan class=\"region\"\u003eCA\u003c/span\u003e \u003cspan class=\"postal-code\"\u003e93407\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eUSA\u003c/span\u003e",
"formatted_address" : "Building 65, 1 Grande Ave, California Polytechnic State University, San Luis Obispo, CA 93407, USA",
"formatted_phone_number" : "(805) 756-4089",
"geometry" : {
"location" : {
"lat" : 35.30001179999999,
"lng" : -120.6586874
}
},
"icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "f70e2b28dda6dbf04550b76db802f20fe1f79d5c",
"international_phone_number" : "+1 805-756-4089",
"name" : "Mustang Station",
"opening_hours" : {
"open_now" : false,
"periods" : [
{
"close" : {
"day" : 0,
"time" : "2300"
},
"open" : {
"day" : 0,
"time" : "1030"
}
},
{
"close" : {
"day" : 1,
"time" : "2300"
},
"open" : {
"day" : 1,
"time" : "1030"
}
},
{
"close" : {
"day" : 2,
"time" : "2300"
},
"open" : {
"day" : 2,
"time" : "1030"
}
},
{
"close" : {
"day" : 3,
"time" : "2300"
},
"open" : {
"day" : 3,
"time" : "1030"
}
},
{
"close" : {
"day" : 4,
"time" : "2300"
},
"open" : {
"day" : 4,
"time" : "1030"
}
},
{
"close" : {
"day" : 6,
"time" : "0000"
},
"open" : {
"day" : 5,
"time" : "1030"
}
},
{
"close" : {
"day" : 0,
"time" : "0000"
},
"open" : {
"day" : 6,
"time" : "1030"
}
}
],
"weekday_text" : [
"Monday: 10:30 AM – 11:00 PM",
"Tuesday: 10:30 AM – 11:00 PM",
"Wednesday: 10:30 AM – 11:00 PM",
"Thursday: 10:30 AM – 11:00 PM",
"Friday: 10:30 AM – 12:00 AM",
"Saturday: 10:30 AM – 12:00 AM",
"Sunday: 10:30 AM – 11:00 PM"
]
},
"photos" : [
{
"height" : 2340,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/112622063888784238324/photos\"\u003eJana Isabel Gervacio\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAGZsi0QehA7q1gTjAThJgTUtDSkkGaL4Xk_x01RkN6t8HfoABoLGl45Gpo_bznS4sI4OKag40IWiCsbq8J-naZ-9YwQ4iZ9H1YrFEBTMdlTWoxnW0uxpABT-2JKn6D7q38yQP5lznOlL7RmghoNxwbSvB6TDk45iwDLMSce-JBPcEhDLAcpTdUku3To8HxDhhszlGhRwBi5muKEn_68_MOAnjx0MLbSBJw",
"width" : 4160
},
{
"height" : 3840,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAB0VKDa1mNnEVRpWtjg8lbM3zONoyqai_LmUB41fP7FtprCairVIzw_QBpKix4ZNOn6swUgNf8C907X0bv8SnMktdacFV_aSy6sOFogdRPveXCBx84p2wrVH95GwTpk0lsNhzLovPuk9oZ39nH1U7XdP3LUfdNWQL2XCgUBqlkICEhDqaRdvjIG9gdp5gUWVfSAMGhRG75JyhhhqUxyZAU62IP_z-oMj7A",
"width" : 5760
},
{
"height" : 3456,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAEb9o0hItdL5eswLOgmJH9EOGNlqfWbjkcwhv9Aqk9yPbqAIhrTkeyun9r-G38kxcpO7QW3hD_MNtik07JAFhY2oY4fXuEeE1pKeAq7faNNytgQDCG37vh_LRqAVEaHa0bIAS22WKMFtOIquAviLkOyNQyT0_DCUXkd2E53OcRqdEhDfUVSCKsC1CHsMPAKv6VjNGhR6wXUF07Xe7KuZ52G1s_tCdGCG6Q",
"width" : 5184
},
{
"height" : 3840,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAHDbQqs7ehYjfkyARQxQq2PVWnIN6z6Enju8bnTmqUq4_UgDeAigezxyhv4b8QC7tT1F0O-OJuqZbhAqyTlXB1OYO_k0_Y7mk1114ah-BG8PUd84KnRD3CXh7G3wducvWrXtNZkFua-CoFdQG_q8050wUDST5tCWA1VeDvNjkw8pEhDs9E0GxCooxR0A6nn0_BkVGhT3Ub9zxr1PGVQFRV_TecWKzZmiYg",
"width" : 5760
},
{
"height" : 3456,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAP9OkyME0q72GrHkLPkjMoaauPmsYhZBD8wH1qBL_JAEGV8Dhz_6HJcUN_Y64ycfkKzk10COR52XmLerELpEYuxAYG3NHUcfF7Yq0GzEaFcNPIRWa4WgSsnAX5y16im6bvF_KZbW5iuDyX4ET6RW6bgTBwVH-zjAlZYmCI5GXpJ0EhDErfuy0lpX8LKAe8ipjC-BGhQqpZa7Y53HQBQvuIH37jORLeD0hQ",
"width" : 5184
},
{
"height" : 3840,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAEWy_E_dGD3N1ChEdeAzZoNP9mU0JhPEZY4QWf1I0XO73PWM8vmrTA0JjHFsm_qCf6XAmiVgJxPQTNtGTHwYghq7NL91bGYOEIvOLYl5iwxP_RC96zn5hCZnwwp1s4xkzouawNKp0oSCzwpfpUgCQrpplf35QLc1xGj3wsMbTcAbEhCUztajO_mhA0BLHk90mDxSGhRKOzWwFMx7Uhxvqh4afBaKSa6S9g",
"width" : 5760
},
{
"height" : 3000,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/116558159141762616471/photos\"\u003ePatrick Chea\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAGWjbZD71nwtfSTA3rRg93F-c_-EyicXxxA8vQ8DSX9hsvDOOCxy8gNUhXF5rDyShtcTm8Gh5qiCGg3xSvA5LDbJiXs7IpGAwAoVTb7_-d4DlNBX0jmkb8tGWdYNkqMo9jTtLr50BY9emgIljAHDaTBrzKlcrgi3Q2rSJM-WnUhaEhC4SwcYYd4Ce2upxRjP8taRGhSsvzcpFjR60jxDLxRlKzhgRIVzWA",
"width" : 4000
},
{
"height" : 800,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAEu4y0vjM28hn4yFnPz1qWQ0iYysDRPNfY0DiTHlmWMhLI1RfFlWctexo-Gw4iM51yDXo1f2C4eOvN5Gh50ZFfOsfuaLBptwzNYdm9wdBt6Hd5JjiUuEWlVLXo4pKz_62v3ohS2OZfdTJ6Wz5Fw44gVYyA_m9nX3fSCuPp8O2MkMEhCJVvjZOZouIyfIDKFkdg4XGhR8Tgj_y6Tibv548tyMmF5pjB_4VA",
"width" : 800
},
{
"height" : 3456,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAAFG2hBYdpnJYG9DjvY1dnAus3YG89BeKGFx8--e0fwq8OPzCvbQVrXkyiB91KkjnMg8Oum11B4-fHVy6PkuXkat-T9r30PjKNs5KQJTYBWZ-U1SvdQoRx4auOdLzrgNNknVYtUD0fnf6L6MyaJajCvuRJxkd5fhmpM0-qYpwwp24EhCAm-eSSO2TX8lQYa1Vkl41GhR82nfX24T7EoP-xSVKjR-RV5KXYQ",
"width" : 3456
},
{
"height" : 5184,
"html_attributions" : [
"\u003ca href=\"https://maps.google.com/maps/contrib/110980259514072024035/photos\"\u003eMustang Station\u003c/a\u003e"
],
"photo_reference" : "CoQBdwAAALUHiKRI96TGd_7wEGmKlvU2j5WcWVl9B0jYBMBJsHyQLHHTROslXcW9dFTi_7aAK_yTcXOTwMoXJye301W6utyysncbDgPMfOru9YC5BTLpFOSpmpQButZ9Iw75MM8jgf5G-FWEtpnCSRSIAaTCg4yPpJWzdVMZyeFxOn7-wx7-EhAYF5iL9wN3hfqccpCq7DivGhR8mRQFqoyXjq6eUuaCLD2RUMj9LQ",
"width" : 3456
}
],
"place_id" : "ChIJi3n5orHx7IARQrPTx81AfZU",
"reference" : "CmRSAAAAwt8fxPAzOX-uQm83_KDcR1Yic89fu-ykEcK2vAJCKS6j1f4_KVCrhoOfQAX8bQd_vXS-k8fEhCQud8JjIhXZBYuIeq3UBfoxhf9zOClHJRi5pstBA21a_FTxP8eyXJ1bEhAMXM_iW_ZlS0LkpOss-b0bGhTVYEqAJEUmeSMUM41wf-1gUBKhCw",
"reviews" : [
{
"aspects" : [
{
"rating" : 2,
"type" : "overall"
}
],
"author_name" : "Spencer Shaw",
"author_url" : "https://www.google.com/maps/contrib/104561547095341505444/reviews",
"language" : "en",
"rating" : 4,
"text" : "",
"time" : 1476463293
},
{
"aspects" : [
{
"rating" : 3,
"type" : "overall"
}
],
"author_name" : "Joseph Pack",
"author_url" : "https://www.google.com/maps/contrib/105745544693109977233/reviews",
"language" : "en",
"profile_photo_url" : "//lh6.googleusercontent.com/-HJVfdTf8Kf0/AAAAAAAAAAI/AAAAAAAABo8/y8qAcuE4h7c/photo.jpg",
"rating" : 5,
"text" : "",
"time" : 1474354270
},
{
"aspects" : [
{
"rating" : 1,
"type" : "overall"
}
],
"author_name" : "Erik Sandberg",
"author_url" : "https://www.google.com/maps/contrib/113791312001095793561/reviews",
"language" : "en",
"profile_photo_url" : "//lh6.googleusercontent.com/-DH91vW9zE6U/AAAAAAAAAAI/AAAAAAAAKiA/Xi3IaYgtIr4/photo.jpg",
"rating" : 3,
"text" : "",
"time" : 1448072416
}
],
"scope" : "GOOGLE",
"types" : [ "restaurant", "food", "point_of_interest", "establishment" ],
"url" : "https://maps.google.com/?cid=10771837136305107778",
"utc_offset" : -480,
"vicinity" : "Building 65, 1 Grande Ave, California Polytechnic State University, San Luis Obispo",
"website" : "https://www.calpolydining.com/mustangstation/"
},
"status" : "OK"
}
There is a feature request in the public issue tracker to add Special Hours in the Places details response:
https://code.google.com/p/gmaps-api-issues/issues/detail?id=10145
It looks like Google created a corresponding internal issue #30233280 and is evaluating the feasibility to implement this.
Please star the feature request in the public issue tracker to express your interest and receive updates from Google.

Elasticsearch not working with 'not_analyzed' index

I am unable to figure out why elasticsearch not searching with not_analysed indexes. I have following settings in my model,
settings index: { number_of_shards: 1 } do
mappings dynamic: 'false' do
indexes :id
indexes :name, index: 'not_analyzed'
indexes :email, index: 'not_analyzed'
indexes :contact_number
end
end
def as_indexed_json(options = {})
as_json(only: [ :id, :name, :username, :user_type, :is_verified, :email, :contact_number ])
end
And my mapping at elasticsearch is right, as below.
{
"users-development" : {
"mappings" : {
"user" : {
"dynamic" : "false",
"properties" : {
"contact_number" : {
"type" : "string"
},
"email" : {
"type" : "string",
"index" : "not_analyzed"
},
"id" : {
"type" : "string"
},
"name" : {
"type" : "string",
"index" : "not_analyzed"
}
}
}
}
}
}
But issue is when I make search on not analyzed fields (name and email, as I wanted them to be not analyzed) it only search on full word. Like in the example below it should have return John, Johny and Tiger, all 3 records. But it only returns 2 of the records.
I am searching as below
settings = {
query: {
filtered: {
filter: {
bool: {
must: [
{ terms: { name: [ "john", "tiger" ] } },
]
}
}
}
},
size: 10
}
User.__elasticsearch__.search(settings).records
This is how I am creating index on my user object in callback after_save,
User.__elasticsearch__.client.indices.create(
index: User.index_name,
id: self.id,
body: self.as_indexed_json,
)
Some of the document that should match
[{
"_index" : "users-development",
"_type" : "user",
"_id" : "670",
"_score" : 1.0,
"_source":{"id":670,"email":"john#monkeyofdoom.com","name":"john baba","contact_number":null}
},
{
"_index" : "users-development",
"_type" : "user",
"_id" : "671",
"_score" : 1.0,
"_source":{"id":671,"email":"human#monkeyofdoom.com","name":"Johny Rocket","contact_number":null}
}
, {
"_index" : "users-development",
"_type" : "user",
"_id" : "736",
"_score" : 1.0,
"_source":{"id":736,"email":"tiger#monkeyofdoom.com","name":"tiger sherof", "contact_number":null}
} ]
Any suggestions please.
I think you would get desired results with keyword toknizer combined with lowercase filter rather than using not_analyzed.
The reason john* did not match Johny was due to case sensitivity.
This setup will work
{
"settings": {
"analysis": {
"analyzer": {
"keyword_analyzer": {
"type": "custom",
"filter": [
"lowercase"
],
"tokenizer": "keyword"
}
}
}
},
"mappings": {
"my_type": {
"properties": {
"name": {
"type": "string",
"analyzer": "keyword_analyzer"
}
}
}
}
}
Now john* will match johny. You should be using multi-fields if you have various requirements. terms query for john wont give you john baba as inside inverted index there is no token as john. You could use standard analyzer on one field and keyword analyzer on other.
As per the documentation term query
The term query finds documents that contain the exact term specified in the inverted index.
You are searching for john but none of your documnents contain john i.e why you were not getting any result. Either you can your field analysed and then apply query string or search for exact term.
Refer https://www.elastic.co/guide/en/elasticsearch/reference/2.x/query-dsl-term-query.html for more details

Google Geocode API only USA results

I'm using the simple URL that Google provides for zip code lookup.
http://maps.googleapis.com/maps/api/geocode/json?address=90210&sensor=true
This URL will return results for the whole world but how do I limit those to just the USA? I looked it up but can't find anything. I'd hate to code more than necessary to make sure there are not any US addresses when there might be a way to add to the URL and get the:
{
"results" : [],
"status" : "ZERO_RESULTS"
}
This is what the API returns if there are no results at all. Much easier.
You could use the component filtering and use the country and the postal_code components
http://maps.googleapis.com/maps/api/geocode/json?sensor=true&components=country:US|postal_code:90210
Perhaps Google had a glitch when you tried the link you provided in your question. I just tried it and it worked fine:
{
"results" : [
{
"address_components" : [
{
"long_name" : "90210",
"short_name" : "90210",
"types" : [ "postal_code" ]
},
{
"long_name" : "Beverly Hills",
"short_name" : "Beverly Hills",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Los Angeles County",
"short_name" : "Los Angeles County",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "California",
"short_name" : "CA",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "United States",
"short_name" : "US",
"types" : [ "country", "political" ]
}
],
"formatted_address" : "Beverly Hills, CA 90210, USA",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 34.1354771,
"lng" : -118.3867129
},
"southwest" : {
"lat" : 34.065094,
"lng" : -118.4423781
}
},
"location" : {
"lat" : 34.1030032,
"lng" : -118.4104684
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 34.1354771,
"lng" : -118.3867129
},
"southwest" : {
"lat" : 34.065094,
"lng" : -118.4423781
}
}
},
"types" : [ "postal_code" ]
}
],
"status" : "OK"
}

Google Places API results for 0,0 Lat Lng

I'm not sure why Google Places API is returning the following results for lat,lng = 0,0 ... shouldn't it be fetching places at the Prime Meridian and Equator intersection, and not just a smattering of cities whose geocoords are clearly not close to 0,0 like:
{
"html_attributions" : [],
"results" : [
{
"geometry" : {
"location" : {
"lat" : 40.7483170,
"lng" : -73.9855290
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "2bf00f9f5e2e3e50098fd611f9fde65cdb453f20",
"name" : "Empire State Building",
"rating" : 4.40,
"reference" : "CnRrAAAAtzNwdIo2Dcf4rhroiiyCyJqarCL7FZQvXxvz6vdYda1MYaxmjfwPdd2k_nyyq1c-urcOZ2GIg3r5GqmjtguEQNlKiYu8706vHJKiZCax-COsvbWHS3WBLWiZ3uYoY2wGclP3D-2loob4rNFa_XavERIQaVGvVVfsV3ayD8D9_-dtqhoUmZInS1ufM4ErRz4s76nX5Wr8PUA",
"types" : [ "amusement_park", "establishment" ],
"vicinity" : "350 5th Avenue, New York"
},
{
"geometry" : {
"location" : {
"lat" : 34.0554640,
"lng" : -118.249760
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "5cf64f5eb238d7e3740c59a49938ceb7c5b08646",
"name" : "Gedung Konser Walt Disney",
"rating" : 4.40,
"reference" : "CnRwAAAAfgumgAs3d8qOytOVUEgMBSbddJ80fSzX7JbsmxHvwZRkto-_tLF1VIgkswR3VRMBRfC5fs4JNcgVEhb2KQbRMFFC1FImwRlSM6igdR5TWpYiP2PlP1tA80SPF8lR_7TNM_fS0GyDM9Y45nE59S-WCxIQKbEIn_MR0ASWWc47N0yx1BoUDbjx_g1pzUAIzfTI7-UcsVdr8n4",
"types" : [ "establishment" ],
"vicinity" : "111 S Grand Ave, Los Angeles"
},
{
"geometry" : {
"location" : {
"lat" : 40.7599740,
"lng" : -73.9800970
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "89dd7f0c82efc14f18954f8abf2925515037927a",
"name" : "Radio City Music Hall",
"rating" : 3.90,
"reference" : "CnRsAAAAz4THB7lZ9nA3Il7YOwfFubKCR91gBo8jHNlXUQWUw7JEliOwoNsvgQOAtECHb7RttpnRFJj2gwMq4aFYR7ndaTlp53rNMpoFp4DDS_EVA1WlioGNqFGEi4vzkQbqetoJ9VN1O9cJg2YJpL7TuR9dNxIQWwsOVjW_tUB5sGlMYSlaSxoUxYYdcSHox7CfUmZ7P0Rc7zV7_e0",
"types" : [ "establishment" ],
"vicinity" : "1260 6 Avenue, New York"
},
{
"geometry" : {
"location" : {
"lat" : 38.8895020,
"lng" : -77.0353030
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "2598a3577d35a8f9ce6cc12c6c20d59fe3f9d1fc",
"name" : "Washington Monument",
"rating" : 3.50,
"reference" : "CnRqAAAAtAuqKVfxJ_ni_49Wg8THdIjk7sK7C3wVMIjoSVPSriDr6Tht5-RvBScdFB_VasYBMR1BO_TESlyHQfCONNh3c2xjVsUPwFLruSPpKZCgA1gZY5eE3amDsFhjB2gZc2zQatv3dBbcW5HxWwK38KDn2xIQj20Ad9IMHh2A15niVVW-ihoUzwSKPeInBDipmiHe-oX0eS751_c",
"types" : [ "park", "establishment" ],
"vicinity" : "2 15th Street Northwest, Washington D.C."
},
{
"geometry" : {
"location" : {
"lat" : 40.7075260,
"lng" : -74.0111520
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "010cda7c358ae874784ef918d1c19e2643c4fec0",
"name" : "NYSE Regulation Inc",
"rating" : 3.40,
"reference" : "CnRqAAAAR8SX_5aQ60pZEffiLIbXTxoXVCdzpIVleLXseSizaa08ZyAV-6HKFoXP_3eFKBcVewUuTgdxX0JJu8idVtjvF-FJnK5-RWt0jp1K2tB2YwOpwHNI7bXnYxqVEATcyH1Y8ft5SXh2uaqRL-SoKwC2hhIQTpljtBc_hALik0ECJD3syhoUmzoPIYGREYJMw1qA4PbeW9yR7_s",
"types" : [ "establishment" ],
"vicinity" : "11 Wall Street, New York"
},
{
"geometry" : {
"location" : {
"lat" : 36.1573480,
"lng" : -115.1483340
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id" : "729e341abb54a12a11d84573d977df0f41acca7b",
"name" : "Las Vegas Pretty Kittens",
"rating" : 4.30,
"reference" : "CnRvAAAA1KMLOeN6uzyj-QGAP5Mqg_qe5IDN3Zl9ID_to_pyaxGD5ERHsLsmvGAT801ST89xdHSXk1Tga950V5RBJX5FGopZ2B7rFIBNDPFxrB9wK4mYgaZiwR-m_j1rdzx9EkEPe3JMEnBZq-Y8djh_V2tX8hIQTk931oTYQPGyVCL1rQQDaRoUzhWJ_Cq1UFvKAhNansZJVO4ipOI",
"types" : [ "lodging", "establishment" ],
"vicinity" : "3798 Las Vegas Blvd, Las Vegas"
},
{
"geometry" : {
"location" : {
"lat" : 40.829750,
"lng" : -73.92613799999999
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/stadium-71.png",
"id" : "4120a48a1c6bae3f896b9022fbe45bbdbb041c8d",
"name" : "Yankee Stadium",
"rating" : 4.40,
"reference" : "CnRlAAAAsHJIlsQHJmkIYUOW_6m1l8th1F5qtG9ULSn6i9-kAc5cjoxRvDmpeqze14ErqEcxVZPT4wLyU_S845VpDzeJH9XeQHFZWUIr_uu8U01xD9VO4TghUfmBikJN5Ap4cn7zf3BPgBnqVcymBMWeOsr0ABIQbNrG__9TSUduj-lSHV8OGBoUW3867le_CNRd-5ZncKMGgu1y-Q4",
"types" : [ "stadium", "establishment" ],
"vicinity" : "1 East 161st Street, Bronx"
},
{
"geometry" : {
"location" : {
"lat" : 36.1475610,
"lng" : -115.155430
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id" : "7a80fe02f232f2f8fb62953d7eca557722b58012",
"name" : "Stratosphere",
"rating" : 3.60,
"reference" : "CnRjAAAAjLLI-i_uFl-t4VGhFXpbA8GOiu5NxFKPvjQVludTJBowR-McYhjy8Xm1sfIi5eDCT4M4nPCJ8Zr-ixYI_lfNVviGAy9qiteA5_KYvlbzVBnDY9Cg2Dl0tjcQeiRy6HoXlXihb_TiOb5pcqQlJyfg_xIQ4HS8Ie0KuGfZxgOBQzBwiBoU2FjrN08mGMZRnFw96ebkGB9iM0c",
"types" : [ "lodging", "establishment" ],
"vicinity" : "2000 South Las Vegas Boulevard, Las Vegas"
},
{
"geometry" : {
"location" : {
"lat" : 36.0989050,
"lng" : -115.1754280
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id" : "5415e1b4a3f278a0f654cecaefd3a8c9c18de6cf",
"name" : "Buca di Beppo - Las Vegas - Excalibur",
"rating" : 3.70,
"reference" : "CoQBfAAAAH4lqpHGSoEJj1NpWM9G9TFv9wd8h1iupqzjFckBVlqWp3Py0-zg0l2uEIQq_1rFDzVIBa7r4uzKSmbj8x_djw2ytBjwdVZHuzPxNH0B6-OsoXgq5VXh_ej0_TQytprNHXkeO6VEhi5REkjtbzOqrwO4n-LwvZ8jdqGZtE-I8BM_EhC--WZHCmvg4s4AQqyBX8pMGhTZfTcTmEPVKyUIGn0J4EcscR6LTA",
"types" : [ "lodging", "establishment" ],
"vicinity" : "3850 Las Vegas Blvd. South, Second Floor, Las Vegas"
},
{
"geometry" : {
"location" : {
"lat" : 34.1025420,
"lng" : -118.3416570
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/movies-71.png",
"id" : "46e0f0dc849234110d70dce04cacefa982f1898a",
"name" : "Kodak Theatre",
"rating" : 4.0,
"reference" : "CnRkAAAA9l1BF_OHV88D0oLmjP0eeB9lvlfSuMoH_Clpk0xN2rprdAs-NVajY82CkWk6q5Xgy_-WaKMadnDFWg1dmvBlM9CSG9YjlEsuGdkGAQ_2JT5BKcQZAsgO-LCInrNGQhHb6UA6EINa_oeWIT5yX2wFgxIQCQYutFUfkTt9lUFGv5Q1qRoUE3TXdS-d8wLXrLijExuCRRS7pKs",
"types" : [ "movie_theater", "establishment" ],
"vicinity" : "6801 Hollywood Boulevard Hollywood, CA 90028"
},
{
"geometry" : {
"location" : {
"lat" : 38.8885120,
"lng" : -77.0201260
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/museum-71.png",
"id" : "6233faaa08c8457051ce7a2ae89260885c3d099e",
"name" : "National Air and Space Museum",
"rating" : 3.90,
"reference" : "CoQBcwAAANunAGpqdW9ux0r61QRMDJJVpXbcWfzQXYc9Lfsjo11AwnOT00qvjgNEML24mmTlo-fwxPqAori2FXzCz75nrk5ZthIoY6rUwT2XqMo_1wLdeIYzI8HBTB5d80lMZCDyYPNIyUXK1BQxkDARI-Djcvm0cxcsd5pkM5nKUcALHClREhDw1unCtEDqrdvaCyiwqO5JGhRlEXlguPNDn8-OhkUM-e2zVIfJHQ",
"types" : [ "museum", "establishment" ],
"vicinity" : "595 Independence Avenue Southwest, Washington"
},
{
"geometry" : {
"location" : {
"lat" : 40.7653850,
"lng" : -73.9796820
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "ff0ea6469ef95cea73f323b77e18bc2065fb3f3f",
"name" : "Carnegie Hall",
"rating" : 3.80,
"reference" : "CnRjAAAAxCg7QA4KqEWMXOJnLZ4tZj_HefkwzsO_c1yGPbgQZ6hEvbKZymhQ6Fr4wffzF8hpRFr9w6teszOKu-IQW0OqUc4jQaHVz0iErmhMAzIbuX7C_QHmnTn8gVKC4K_Zlp4vDS5AL9-GzhEkj_rYmyg3FhIQ7YW9PNRhxLTkVvi3wBLALxoUiEwWkeBsTM_FrUybFcqpToYbtS0",
"types" : [ "establishment" ],
"vicinity" : "881 7th Ave, New York"
},
{
"geometry" : {
"location" : {
"lat" : 37.7714720,
"lng" : -122.4686720
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "d0f545120ffb6baec5da1ab9e5a9c19f49115dc5",
"name" : "Fine Arts Museums of San Francisco: Facility Rentals",
"rating" : 4.10,
"reference" : "CpQBiwAAAL6id9WjmuDsGHBq1ikNCGmYv1i652crIWcDwPNOMazjrCYvde35uVNQIsdzRDcEBIEXgzIm3Vi9CmUPLevsigYOAd3TQ61z5huCv_53jSlITWzcKsaOa_ZAQQPZyMpYPwhkxnYESU-4GFzzoLFzH1-afqCKcwrFAauKCDcTvwy2qfYPXfio1grIEKfBln83qRIQrmVEtNeLqO5n9WOjjXhJMhoUfZkJU9kN8CAIOY__1Y3syoPB_1k",
"types" : [ "restaurant", "museum", "food", "establishment" ],
"vicinity" : "50 Hagiwara Tea Garden Drive, San Francisco"
},
{
"geometry" : {
"location" : {
"lat" : 40.6709750,
"lng" : -73.96363599999999
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/museum-71.png",
"id" : "50536f2341830cb033e6342fb2e123d88fb5262b",
"name" : "Brooklyn Museum",
"rating" : 4.30,
"reference" : "CnRmAAAAurnWOaSKJ3xC5JCHa0RpCbJ4o36w6z2FDWePJNM2wPhvlp9PyyLNe_REHiA82IlTTaoUKXSJRecUr-CW88YfzNsEZ20GQFXm21PKkgrrF1vP0NL6S-wb4xbr_k5vNnZgW1_5rVf7AsPg_02xRDc2BBIQRIERe2yg8Xi94SOFussv3hoU1ym_ci8XQ7W1US6tdpOTvtMMDCw",
"types" : [ "museum", "establishment" ],
"vicinity" : "200 Eastern Parkway, Brooklyn"
},
{
"geometry" : {
"location" : {
"lat" : 41.881320,
"lng" : -87.674280
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/stadium-71.png",
"id" : "99dbf0f7af6e6fd7fe9f48b5cfd5d9374d40eee7",
"name" : "Madison & United Center (1900 W)",
"rating" : 4.60,
"reference" : "CoQBdwAAAIwXyy6eDjcW_4Bub5XvmGHiqMJ-Stl1QIYLE9y7i2vC1TCCAUXGYB9y-ydP4rs7A3YP5ux5Eh5dfWpczrUEIz7FFhBXHCcu7mKFGx8ifLXTg6NWjLtXGSBMk5UOkuMlQ759B4UGufhgLNCPXdrPqO6kTMZG8VQ1tenNlPLPtkWrEhB2WMI2FjYGBmlCHBYayIFGGhT2uist4FA0sRJmBj3o4iALDgBT9Q",
"types" : [ "stadium", "establishment" ],
"vicinity" : "1901 West Madison Street, Chicago"
},
{
"geometry" : {
"location" : {
"lat" : 36.1214190,
"lng" : -115.1704240
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/lodging-71.png",
"id" : "8fdee88bfe0bc1d70eaf2a1c8528934528344298",
"name" : "The Venetian",
"rating" : 4.10,
"reference" : "CnRjAAAAMATHKiVvbWVf4PLp8RwYQB_pHCu_3Fua1MQ7Gl5B1xNDHU9WkICPeu__TGD5Hfgb47b9V6bCxEkgLFbi21dwOThtDjtby4tDH2HnL7iba6_CxYrgMOrP-WOuh4HMPqCU5Fu5Tm2mttHLgNQ3H2eCKBIQ99KyfeOqL8Ke8eF_IQWehxoUsjo-AknTVGd_LpuAIcBlKFtw0LY",
"types" : [ "lodging", "establishment" ],
"vicinity" : "3355 Las Vegas Boulevard South, Las Vegas"
},
{
"geometry" : {
"location" : {
"lat" : 40.8647670,
"lng" : -73.9317990
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/museum-71.png",
"id" : "8edf774a665aeb294a6d6cf8df4405f4824f7e4f",
"name" : "The Cloisters",
"rating" : 3.90,
"reference" : "CnRkAAAAoXh2hlwgjHoK57WLbYJXZylMK2E96FRHa_TzNBEq4vxTUHrq_eguI58Yo0iQRBtFX3ro5U8OdwzMreDpgUTnVFMPRCzxWyshdL-tCaEjIWK-3VpdCHh4imG3x_fjLfqgFi4Ndf48gctZhrOg-0RNdhIQnpmnyP-W9TN1HmvwTeNtUBoUQ2BQXpiGHWltpzK1zKGdq8FIYzk",
"types" : [ "museum", "establishment" ],
"vicinity" : "99 Margaret Corbin Drive, New York"
},
{
"geometry" : {
"location" : {
"lat" : 38.8959010,
"lng" : -77.0552390
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/generic_business-71.png",
"id" : "66763890699cdd158cff72bffe0f7ab48c755a43",
"name" : "The John F. Kennedy Center for the Performing Arts",
"rating" : 4.50,
"reference" : "CpQBiQAAAK5sBdti2mRClLvnnl7-P_sAs0ptzxUvT4YWZ9bYP4wyIPHzvSv2D3DAhx_tK7g_jsKM7qnbIhXrJW_9Bb7XU9XexgIsm6rSRkTGuN70JRy5d4ztsl8ZVaYBjSewb0AS98TB84E5Xx-l9IsKhx3hypgCFI5u-CuC6vlmjVNdR-u-cgHTx1B5HTZpkTXIm5muqxIQ2lINhfQKQsl6YzCKMzLGNxoUMxrl7OJKpqEBCRxUu7A1GrsiWto",
"types" : [ "establishment" ],
"vicinity" : "2700 F Street Northwest, Washington"
},
{
"geometry" : {
"location" : {
"lat" : 40.782820,
"lng" : -73.9591570
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/museum-71.png",
"id" : "aa09742d854b00192daed833e2a56750587e8185",
"name" : "Solomon R. Guggenheim Museum",
"rating" : 3.10,
"reference" : "CoQBcgAAAOrwNzRmsnbhv193CwDcwpw0PlTBBEGoYm6ksdTk5Ro73hmIJnRsOqXHvfKrDoXCLC_MHwW9gjEEp_t789Afn_sRj8dn1IlQJ8TontYBEf-pLXmNNt104Y14fAsHykQ2JyifjuUoCsykKt_E04AIM2A1H939uAMJPc6R0VEgaZNYEhBCqGL-r9yCh4zZjLqafPekGhRE0aNDwrGBz9XYHMmeudjhFjlsIQ",
"types" : [ "museum", "establishment" ],
"vicinity" : "1071 5th Avenue, New York"
},
{
"geometry" : {
"location" : {
"lat" : 40.8042110,
"lng" : -73.96284199999999
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/worship_general-71.png",
"id" : "b7f595c8882d8b5c347f124cb06be5a18ba794d9",
"name" : "Cathedral Church of St. John the Divine",
"rating" : 4.0,
"reference" : "CoQBfgAAAFuadX23-mmKRnASp9ylUzW0Ghz3d8CuqZ55tX2T4BrODOTVDpOZn55xKqjuemfE-7hrdYOfaLff4RKkEzCkbhTR5UX8iGDCcMHQq2O7aWoqA2tsa5dCBkta8eTy-Bpry8zf2iaRVEZbx1Wfq2Xg59vvu07bryUX4sPVNRO5wKkyEhAXHfHMMaiMKjkvhezqXDk1GhQMHvS79gfVmdb2EQYKWL3df6Y-ag",
"types" : [ "church", "place_of_worship", "establishment" ],
"vicinity" : "1047 Amsterdam Avenue, New York"
}
],
"status" : "OK"
}
API doc here
Call this url to get above results:
https://maps.googleapis.com/maps/api/place/search/json?location=0,0&radius=5&sensor=false&key=[insert key here]
Anyone know why it's giving the above results?
Oddly enough, I've been to all of those places... I wonder if these 0,0 results are session or IP-address based...
This must be a database-error, I get the same results for 0/0.
I was playing around a little bit, for 0.1/0.1 I got this funny results(note that the markers are really at 0.1/0.1 )
http://fiddle.jshell.net/doktormolle/aZrvs/33/show/ (I reported the wrong markers, maybe they will be removed soon)
Places from Brasil, Mexico, Belgium, Germany and China now are placed in the gulf of guinea ^^
When you click on the markers and then on "Details" you'll see that those errors also occure on the official google-places-pages.
This appears to be a bug in the Google Places API. I have submitted it internally.
For future bugs in the Google Places API you can submit them through the Google Maps API Issue tracker as a 'Places API - Bug':
http://code.google.com/p/gmaps-api-issues/issues/entry?template=Places%20API%20-%20Bug