Skip to content

Instantly share code, notes, and snippets.

@sgrove
Created July 14, 2018 01:29
Show Gist options
  • Save sgrove/4e7637b22e81acb07b9f632fc03f57e8 to your computer and use it in GitHub Desktop.
Save sgrove/4e7637b22e81acb07b9f632fc03f57e8 to your computer and use it in GitHub Desktop.
Google Maps (Reverse+) Geolocation and Elevation API
{
google(auths: { googleMapsKey: "..." }) {
maps {
intersection: geolocation(address: "Eddy & Franklin St, San Francisco, CA") {
...fullMap
}
point: reverseGeolocation(
point: { lat: 37.7478646802915, lng: -122.4578673697085 }
) {
...fullMap
}
daniel: geolocation(address: "643 Natoma, San Francisco, CA") {
...fullMap
}
google: geolocation(
address: "1600 Amphitheatre Parkway, Mountain View, CA"
) {
...fullMap
}
savvy: geolocation(address: "16 Merced, San Francisco, CA") {
...fullMap
}
elevation(
locations: [
{ lat: 37.7478646802915, lng: -122.4578673697085 }
{ lat: 37.7775189, lng: -122.410841 }
]
) {
resolution
location {
lat
lng
}
elevation
}
}
}
}
fragment fullMap on GoogleMapsGeolocation {
placeId
types
formattedAddress
geometry {
locationType
location {
lat
lng
elevation {
elevation
resolution
}
}
viewport {
northEast {
lat
lng
elevation {
elevation
resolution
}
}
southWest {
lat
lng
elevation {
elevation
resolution
}
}
}
}
addressComponents {
longName
shortName
types
}
}
{
"data": {
"google": {
"maps": {
"intersection": {
"placeId": "EjNGcmFua2xpbiBTdCAmIEVkZHkgU3QsIFNhbiBGcmFuY2lzY28sIENBIDk0MTA5LCBVU0EioAEinQEKFAoSCWH_9baXgIWAER9n8VSFGy1AEhQKEglh__W2l4CFgBEfZ_FUhRstQBoUChIJaVPrWZWAhYARUDSiDHyLr8MaTQpLCdXiT529gIWAEQ_A4-g4ZwjmGjcLENOFuEIaLiosChQKEgnV4k-dvYCFgBEPwOPoOGcI5hIUChIJaVPrWZWAhYARUDSiDHyLr8MMIgoNQi6FFhVizwe3",
"types": [
"intersection"
],
"formattedAddress": "Franklin St & Eddy St, San Francisco, CA 94109, USA",
"geometry": {
"locationType": "GEOMETRIC_CENTER",
"location": {
"lat": 37.7826882,
"lng": -122.4224926,
"elevation": {
"elevation": 39.62939834594727,
"resolution": 0.5964969992637634
}
},
"viewport": {
"northEast": {
"lat": 37.7840371802915,
"lng": -122.4211436197085,
"elevation": {
"elevation": 38.91522979736328,
"resolution": 0.5964969992637634
}
},
"southWest": {
"lat": 37.7813392197085,
"lng": -122.4238415802915,
"elevation": {
"elevation": 30.46446800231934,
"resolution": 0.5964969992637634
}
}
}
},
"addressComponents": [
{
"longName": "Franklin Street & Eddy Street",
"shortName": "Franklin St & Eddy St",
"types": [
"intersection"
]
},
{
"longName": "Fillmore District",
"shortName": "Fillmore District",
"types": [
"neighborhood",
"political"
]
},
{
"longName": "San Francisco",
"shortName": "SF",
"types": [
"locality",
"political"
]
},
{
"longName": "San Francisco County",
"shortName": "San Francisco County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"longName": "California",
"shortName": "CA",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"longName": "United States",
"shortName": "US",
"types": [
"country",
"political"
]
},
{
"longName": "94109",
"shortName": "94109",
"types": [
"postal_code"
]
}
]
},
"point": {
"placeId": "EjMyOTUgTGFndW5hIEhvbmRhIEJsdmQsIFNhbiBGcmFuY2lzY28sIENBIDk0MTE2LCBVU0EiGxIZChQKEgljSzZ4732PgBHQI1QPbZHStBCnAg",
"types": [
"street_address"
],
"formattedAddress": "295 Laguna Honda Blvd, San Francisco, CA 94116, USA",
"geometry": {
"locationType": "RANGE_INTERPOLATED",
"location": {
"lat": 37.7480678,
"lng": -122.458716,
"elevation": {
"elevation": 135.6211547851562,
"resolution": 9.543951988220215
}
},
"viewport": {
"northEast": {
"lat": 37.7494167802915,
"lng": -122.4573670197085,
"elevation": {
"elevation": 151.1641235351562,
"resolution": 9.543951988220215
}
},
"southWest": {
"lat": 37.74671881970851,
"lng": -122.4600649802915,
"elevation": {
"elevation": 144.2392730712891,
"resolution": 9.543951988220215
}
}
}
},
"addressComponents": [
{
"longName": "295",
"shortName": "295",
"types": [
"street_number"
]
},
{
"longName": "Laguna Honda Boulevard",
"shortName": "Laguna Honda Blvd",
"types": [
"route"
]
},
{
"longName": "Midtown Terrace",
"shortName": "Midtown Terrace",
"types": [
"neighborhood",
"political"
]
},
{
"longName": "San Francisco",
"shortName": "SF",
"types": [
"locality",
"political"
]
},
{
"longName": "San Francisco County",
"shortName": "San Francisco County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"longName": "California",
"shortName": "CA",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"longName": "United States",
"shortName": "US",
"types": [
"country",
"political"
]
},
{
"longName": "94116",
"shortName": "94116",
"types": [
"postal_code"
]
}
]
},
"daniel": {
"placeId": "ChIJEc8LG4OAhYARenR2ChzCyV4",
"types": [
"street_address"
],
"formattedAddress": "643 Natoma St, San Francisco, CA 94103, USA",
"geometry": {
"locationType": "ROOFTOP",
"location": {
"lat": 37.7775189,
"lng": -122.410841,
"elevation": {
"elevation": 8.696775436401367,
"resolution": 0.5964969992637634
}
},
"viewport": {
"northEast": {
"lat": 37.7788678802915,
"lng": -122.4094920197085,
"elevation": {
"elevation": 8.333955764770508,
"resolution": 0.5964969992637634
}
},
"southWest": {
"lat": 37.7761699197085,
"lng": -122.4121899802915,
"elevation": {
"elevation": 9.933512687683105,
"resolution": 0.5964969992637634
}
}
}
},
"addressComponents": [
{
"longName": "643",
"shortName": "643",
"types": [
"street_number"
]
},
{
"longName": "Natoma Street",
"shortName": "Natoma St",
"types": [
"route"
]
},
{
"longName": "South of Market",
"shortName": "South of Market",
"types": [
"neighborhood",
"political"
]
},
{
"longName": "San Francisco",
"shortName": "SF",
"types": [
"locality",
"political"
]
},
{
"longName": "San Francisco County",
"shortName": "San Francisco County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"longName": "California",
"shortName": "CA",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"longName": "United States",
"shortName": "US",
"types": [
"country",
"political"
]
},
{
"longName": "94103",
"shortName": "94103",
"types": [
"postal_code"
]
},
{
"longName": "2719",
"shortName": "2719",
"types": [
"postal_code_suffix"
]
}
]
},
"google": {
"placeId": "ChIJ2eUgeAK6j4ARbn5u_wAGqWA",
"types": [
"street_address"
],
"formattedAddress": "1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA",
"geometry": {
"locationType": "ROOFTOP",
"location": {
"lat": 37.4215421,
"lng": -122.0840106,
"elevation": {
"elevation": 6.992377281188965,
"resolution": 4.771975994110107
}
},
"viewport": {
"northEast": {
"lat": 37.42289108029149,
"lng": -122.0826616197085,
"elevation": {
"elevation": 3.71358060836792,
"resolution": 4.771975994110107
}
},
"southWest": {
"lat": 37.42019311970849,
"lng": -122.0853595802915,
"elevation": {
"elevation": 3.819998025894165,
"resolution": 4.771975994110107
}
}
}
},
"addressComponents": [
{
"longName": "1600",
"shortName": "1600",
"types": [
"street_number"
]
},
{
"longName": "Amphitheatre Parkway",
"shortName": "Amphitheatre Pkwy",
"types": [
"route"
]
},
{
"longName": "Mountain View",
"shortName": "Mountain View",
"types": [
"locality",
"political"
]
},
{
"longName": "Santa Clara County",
"shortName": "Santa Clara County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"longName": "California",
"shortName": "CA",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"longName": "United States",
"shortName": "US",
"types": [
"country",
"political"
]
},
{
"longName": "94043",
"shortName": "94043",
"types": [
"postal_code"
]
}
]
},
"savvy": {
"placeId": "ChIJc5o-Qe99j4ARoZF5OaeKVIo",
"types": [
"premise"
],
"formattedAddress": "16 Merced Ave, San Francisco, CA 94127, USA",
"geometry": {
"locationType": "ROOFTOP",
"location": {
"lat": 37.7465323,
"lng": -122.4592632,
"elevation": {
"elevation": 144.5983734130859,
"resolution": 9.543951988220215
}
},
"viewport": {
"northEast": {
"lat": 37.7478646802915,
"lng": -122.4578673697085,
"elevation": {
"elevation": 150.0371398925781,
"resolution": 9.543951988220215
}
},
"southWest": {
"lat": 37.7451667197085,
"lng": -122.4605653302915,
"elevation": {
"elevation": 148.0618438720703,
"resolution": 9.543951988220215
}
}
}
},
"addressComponents": [
{
"longName": "16",
"shortName": "16",
"types": [
"street_number"
]
},
{
"longName": "Merced Avenue",
"shortName": "Merced Ave",
"types": [
"route"
]
},
{
"longName": "Forest Hill Extension",
"shortName": "Forest Hill Extension",
"types": [
"neighborhood",
"political"
]
},
{
"longName": "San Francisco",
"shortName": "SF",
"types": [
"locality",
"political"
]
},
{
"longName": "San Francisco County",
"shortName": "San Francisco County",
"types": [
"administrative_area_level_2",
"political"
]
},
{
"longName": "California",
"shortName": "CA",
"types": [
"administrative_area_level_1",
"political"
]
},
{
"longName": "United States",
"shortName": "US",
"types": [
"country",
"political"
]
},
{
"longName": "94127",
"shortName": "94127",
"types": [
"postal_code"
]
},
{
"longName": "1026",
"shortName": "1026",
"types": [
"postal_code_suffix"
]
}
]
},
"elevation": [
{
"resolution": 9.543951988220215,
"location": {
"lat": 37.747865,
"lng": -122.457867
},
"elevation": 150.0371398925781
},
{
"resolution": 0.5964969992637634,
"location": {
"lat": 37.777519,
"lng": -122.410841
},
"elevation": 8.696775436401367
}
]
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment