Skip to content

Instantly share code, notes, and snippets.

@marpontes
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marpontes/8919021 to your computer and use it in GitHub Desktop.
Save marpontes/8919021 to your computer and use it in GitHub Desktop.
Idea for CEP [brazilian postal code] GEO webservice - this is a sample document that will be store in Mongodb postal collection.
/*
* Model of document to be stored, maintained and incremented
*/
{
"_id": "51111040",
"pos": [-35.2560503, -5.896805199999999],
"cntr": {
"n": "Brazil",
"pos": [-35.2560503, -5.896805199999999]
},
"st": {
"n": "Pernambuco",
"pos": [-35.2560503, -5.896805199999999]
},
"cty": {
"name": "Brazil",
"pos": [-35.2560503, -5.896805199999999]
},
"q_rep": {
"srv_n": "Republica Virtual",
"found": true,
"url": "cep.republicavirtual.com.br/web_cep.php?formato=javascript&cep=73015132",
"q_date": new Date('Jun 23, 1912'),
"q_resp": {
"resultado": "1",
"resultado_txt": "sucesso - cep completo",
"uf": "PE",
"cidade": "Recife",
"bairro": "Boa Viagem",
"tipo_logradouro": "Rua",
"logradouro": "Ana Camelo da Silva"
}
},
"q_loc": {
"srv_n": "Base Local",
"found": true,
"q_date": new Date('Jun 23, 1912'),
"q_resp": {
"uf": "PE",
"cidade": "Recife",
"bairro": "Boa Viagem",
"tipo_logradouro": "Rua",
"logradouro": "Ana Camelo da Silva",
"tipo_cep": "UF"
}
},
"q_goo": {
"srv_n": "Google",
"found": true,
"url": "maps.googleapis.com/maps/api/geocode/json?sensor=true&components=postal_code:51111-040",
"q_date": new Date('Jun 23, 1912'),
"q_resp": {
"results": [{
"address_components": [{
"long_name": "51111-040",
"short_name": "51111-040",
"types": ["postal_code"]
}, {
"long_name": "Recife",
"short_name": "Recife",
"types": ["locality", "political"]
}, {
"long_name": "Recife",
"short_name": "Recife",
"types": ["administrative_area_level_2", "political"]
}, {
"long_name": "Pernambuco",
"short_name": "PE",
"types": ["administrative_area_level_1", "political"]
}, {
"long_name": "Brazil",
"short_name": "BR",
"types": ["country", "political"]
}],
"formatted_address": "Recife - Pernambuco, 51111-040, Brazil",
"geometry": {
"bounds": {
"northeast": {
"lat": -8.105385499999999,
"lng": -34.8900033
},
"southwest": {
"lat": -8.113959699999999,
"lng": -34.9010354
}
},
"location": {
"lat": -8.1056601,
"lng": -34.891029
},
"location_type": "APPROXIMATE",
"viewport": {
"northeast": {
"lat": -8.105385499999999,
"lng": -34.8900033
},
"southwest": {
"lat": -8.108986999999999,
"lng": -34.8941405
}
}
},
"types": ["postal_code"]
}],
"status": "OK"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment