Skip to content

Geocoding Service Provider Notes

Rob Banagale edited this page Apr 9, 2020 · 2 revisions

Google Maps API v3

Geocode responses example that returns neighborhood only instead of city:

street_address = '18131 SLADE SCHOOL ROAD SANDY SPRING MD' gmaps.geocode(address=street_address, region='US')

[{
	"address_components": [{
		"long_name": "18131",
		"short_name": "18131",
		"types": ["street_number"]
	}, {
		"long_name": "Slade School Road",
		"short_name": "Slade School Rd",
		"types": ["route"]
	}, {
		"long_name": "Sandy Spring",
		"short_name": "Sandy Spring",
		"types": ["neighborhood", "political"]
	}, {
		"long_name": "District 8",
		"short_name": "District 8",
		"types": ["administrative_area_level_3", "political"]
	}, {
		"long_name": "Montgomery County",
		"short_name": "Montgomery County",
		"types": ["administrative_area_level_2", "political"]
	}, {
		"long_name": "Maryland",
		"short_name": "MD",
		"types": ["administrative_area_level_1", "political"]
	}, {
		"long_name": "United States",
		"short_name": "US",
		"types": ["country", "political"]
	}, {
		"long_name": "20860",
		"short_name": "20860",
		"types": ["postal_code"]
	}],
	"formatted_address": "18131 Slade School Rd, Sandy Spring, MD 20860, USA",
	"geometry": {
		"location": {
			"lat": 39.154574,
			"lng": -77.03975899999999
		},
		"location_type": "ROOFTOP",
		"viewport": {
			"northeast": {
				"lat": 39.15592298029149,
				"lng": -77.0384100197085
			},
			"southwest": {
				"lat": 39.15322501970849,
				"lng": -77.0411079802915
			}
		}
	},
	"place_id": "ChIJ3f4PJcLQt4kRGMID2hsq0gs",
	"plus_code": {
		"compound_code": "5X36+R3 Sandy Spring, Ashton-Sandy Spring, MD, United States",
		"global_code": "87F45X36+R3"
	},
	"types": ["street_address"]
}]