mirror of https://github.com/tasks/tasks
Remove Mapbox SDK and use Mapbox HTTP API
parent
14f5015fac
commit
9126c29aaa
@ -1,48 +1,72 @@
|
||||
package org.tasks.location
|
||||
|
||||
import android.content.Context
|
||||
import com.google.gson.GsonBuilder
|
||||
import com.google.gson.JsonElement
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
import com.mapbox.api.geocoding.v5.MapboxGeocoding
|
||||
import com.mapbox.geojson.Point
|
||||
import dagger.hilt.android.qualifiers.ApplicationContext
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.tasks.BuildConfig
|
||||
import okhttp3.OkHttpClient
|
||||
import okhttp3.Request
|
||||
import org.tasks.DebugNetworkInterceptor
|
||||
import org.tasks.R
|
||||
import org.tasks.data.Place
|
||||
import org.tasks.data.Place.Companion.newPlace
|
||||
import timber.log.Timber
|
||||
import org.tasks.preferences.Preferences
|
||||
import java.io.IOException
|
||||
import javax.inject.Inject
|
||||
|
||||
class MapboxGeocoder @Inject constructor(@ApplicationContext context: Context) : Geocoder {
|
||||
private val token: String = context.getString(R.string.mapbox_key)
|
||||
class MapboxGeocoder @Inject constructor(
|
||||
@ApplicationContext context: Context,
|
||||
private val preferences: Preferences,
|
||||
private val interceptor: DebugNetworkInterceptor,
|
||||
) : Geocoder {
|
||||
private val token = context.getString(R.string.mapbox_key)
|
||||
|
||||
override suspend fun reverseGeocode(mapPosition: MapPosition): Place =
|
||||
override suspend fun reverseGeocode(mapPosition: MapPosition): Place? =
|
||||
withContext(Dispatchers.IO) {
|
||||
val response = MapboxGeocoding.builder()
|
||||
.accessToken(token)
|
||||
.query(Point.fromLngLat(mapPosition.longitude, mapPosition.latitude))
|
||||
.build()
|
||||
.executeCall()
|
||||
val body = response.body()
|
||||
if (response.isSuccessful && body != null) {
|
||||
Timber.d(prettyPrint(body.toJson()))
|
||||
val features = body.features()
|
||||
if (features.size > 0) {
|
||||
return@withContext newPlace(features[0])
|
||||
}
|
||||
val builder = OkHttpClient().newBuilder()
|
||||
if (preferences.isFlipperEnabled) {
|
||||
interceptor.apply(builder)
|
||||
}
|
||||
val client = builder.build()
|
||||
val url = "https://api.mapbox.com/geocoding/v5/mapbox.places/${mapPosition.longitude},${mapPosition.latitude}.json?access_token=$token"
|
||||
val response = client.newCall(Request.Builder().get().url(url).build()).execute()
|
||||
if (response.isSuccessful) {
|
||||
response.body?.string()?.let { jsonToPlace(it) }
|
||||
} else {
|
||||
Timber.e(response.errorBody()!!.string())
|
||||
throw IOException("${response.code} ${response.message}")
|
||||
}
|
||||
newPlace(mapPosition)!!
|
||||
}
|
||||
|
||||
companion object {
|
||||
private fun prettyPrint(json: String): String {
|
||||
return if (BuildConfig.DEBUG) {
|
||||
GsonBuilder().setPrettyPrinting().create().toJson(JsonParser().parse(json))
|
||||
} else json
|
||||
}
|
||||
internal fun jsonToPlace(json: String): Place? =
|
||||
JsonParser
|
||||
.parseString(json).asJsonObject.getAsJsonArray("features")
|
||||
.takeIf { it.size() > 0 }?.get(0)?.asJsonObject
|
||||
?.let { toPlace(it) }
|
||||
|
||||
internal fun toPlace(feature: JsonObject): Place =
|
||||
newPlace().apply {
|
||||
val types = feature.get("place_type").asStringList
|
||||
val text = feature.get("text").asString
|
||||
name = if (types.contains("address")) {
|
||||
"${feature.get("address").asString} $text"
|
||||
} else {
|
||||
text
|
||||
}
|
||||
address = feature.get("place_name").asString
|
||||
feature.get("center").asCoordinates.let {
|
||||
longitude = it.first
|
||||
latitude = it.second
|
||||
}
|
||||
}
|
||||
|
||||
private val JsonElement.asStringList: List<String>
|
||||
get() = asJsonArray.map { it.asString }
|
||||
|
||||
private val JsonElement.asCoordinates: Pair<Double, Double>
|
||||
get() = asJsonArray.let { Pair(it[0].asDouble, it[1].asDouble) }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package org.tasks.location
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Test
|
||||
import org.tasks.TestUtilities.readFile
|
||||
import org.tasks.location.MapboxGeocoder.Companion.jsonToPlace
|
||||
|
||||
class MapboxGeocoderTest {
|
||||
@Test
|
||||
fun poiGeocode() {
|
||||
val place = jsonToPlace(readFile("mapbox/poi.json"))!!
|
||||
|
||||
assertEquals("Guaranteed Rate Field", place.name)
|
||||
assertEquals(-87.63380599999999, place.longitude, 0.0)
|
||||
assertEquals(41.8299365, place.latitude, 0.0)
|
||||
assertEquals(
|
||||
"Guaranteed Rate Field, 333 W 35th St, Chicago, Illinois 60616, United States",
|
||||
place.address
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun addressGeocode() {
|
||||
val place = jsonToPlace(readFile("mapbox/address.json"))!!
|
||||
|
||||
assertEquals("120 East 13th Street", place.name)
|
||||
assertEquals(40.7330031, place.latitude, 0.0)
|
||||
assertEquals(-73.9888929, place.longitude, 0.0)
|
||||
assertEquals(
|
||||
"120 East 13th Street, New York, New York 10003, United States",
|
||||
place.address
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package org.tasks.location
|
||||
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.tasks.TestUtilities.readFile
|
||||
import org.tasks.location.MapboxSearchProvider.Companion.jsonToSearchResults
|
||||
|
||||
class MapboxPlaceSearchTest {
|
||||
@Test
|
||||
fun searchWithMultipleResults() {
|
||||
val results = jsonToSearchResults(readFile("mapbox/search.json"))
|
||||
|
||||
assertEquals(
|
||||
listOf(
|
||||
"poi.627065251624",
|
||||
"poi.472446436443",
|
||||
"poi.89343",
|
||||
"poi.549755920662",
|
||||
"poi.755914248504"
|
||||
),
|
||||
results.map { it.id }
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun validatePlace() {
|
||||
val place = jsonToSearchResults(readFile("mapbox/search.json"))[1]
|
||||
|
||||
assertEquals("poi.472446436443", place.id)
|
||||
assertEquals("Portillo's", place.name)
|
||||
assertEquals(-87.962508, place.place.longitude, 0.0)
|
||||
assertEquals(41.895473, place.place.latitude, 0.0)
|
||||
assertEquals(
|
||||
"155 S Il Route 83, Elmhurst, Illinois 60126, United States",
|
||||
place.address
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun emptySearchResults() =
|
||||
assertTrue(jsonToSearchResults(readFile("mapbox/empty_search.json")).isEmpty())
|
||||
}
|
||||
@ -0,0 +1,407 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"query": [
|
||||
-73.989,
|
||||
40.733
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"id": "address.5326841146807324",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"address"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"accuracy": "rooftop"
|
||||
},
|
||||
"text": "East 13th Street",
|
||||
"place_name": "120 East 13th Street, New York, New York 10003, United States",
|
||||
"center": [
|
||||
-73.9888929,
|
||||
40.7330031
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-73.9888929,
|
||||
40.7330031
|
||||
]
|
||||
},
|
||||
"address": "120",
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.2103290",
|
||||
"text": "Greenwich Village"
|
||||
},
|
||||
{
|
||||
"id": "postcode.13482670360296810",
|
||||
"text": "10003"
|
||||
},
|
||||
{
|
||||
"id": "locality.12696928000137850",
|
||||
"wikidata": "Q11299",
|
||||
"text": "Manhattan"
|
||||
},
|
||||
{
|
||||
"id": "place.15278078705964500",
|
||||
"wikidata": "Q60",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "district.12113562209855570",
|
||||
"wikidata": "Q500416",
|
||||
"text": "New York County"
|
||||
},
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "neighborhood.2103290",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"neighborhood"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {},
|
||||
"text": "Greenwich Village",
|
||||
"place_name": "Greenwich Village, Manhattan, New York, New York 10003, United States",
|
||||
"bbox": [
|
||||
-74.005282,
|
||||
40.72586,
|
||||
-73.98734,
|
||||
40.73907
|
||||
],
|
||||
"center": [
|
||||
-74.0029,
|
||||
40.7284
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-74.0029,
|
||||
40.7284
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "postcode.13482670360296810",
|
||||
"text": "10003"
|
||||
},
|
||||
{
|
||||
"id": "locality.12696928000137850",
|
||||
"wikidata": "Q11299",
|
||||
"text": "Manhattan"
|
||||
},
|
||||
{
|
||||
"id": "place.15278078705964500",
|
||||
"wikidata": "Q60",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "district.12113562209855570",
|
||||
"wikidata": "Q500416",
|
||||
"text": "New York County"
|
||||
},
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "postcode.13482670360296810",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"postcode"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {},
|
||||
"text": "10003",
|
||||
"place_name": "New York, New York 10003, United States",
|
||||
"bbox": [
|
||||
-73.9996058238451,
|
||||
40.7229310019,
|
||||
-73.9798620096375,
|
||||
40.7396749960342
|
||||
],
|
||||
"center": [
|
||||
-73.99,
|
||||
40.73
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-73.99,
|
||||
40.73
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "locality.12696928000137850",
|
||||
"wikidata": "Q11299",
|
||||
"text": "Manhattan"
|
||||
},
|
||||
{
|
||||
"id": "place.15278078705964500",
|
||||
"wikidata": "Q60",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "district.12113562209855570",
|
||||
"wikidata": "Q500416",
|
||||
"text": "New York County"
|
||||
},
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "locality.12696928000137850",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"locality"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q11299"
|
||||
},
|
||||
"text": "Manhattan",
|
||||
"place_name": "Manhattan, New York, New York, United States",
|
||||
"bbox": [
|
||||
-74.047313153061,
|
||||
40.679573,
|
||||
-73.907,
|
||||
40.8820749648427
|
||||
],
|
||||
"center": [
|
||||
-73.9597,
|
||||
40.7903
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-73.9597,
|
||||
40.7903
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "place.15278078705964500",
|
||||
"wikidata": "Q60",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "district.12113562209855570",
|
||||
"wikidata": "Q500416",
|
||||
"text": "New York County"
|
||||
},
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "place.15278078705964500",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"place"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q60"
|
||||
},
|
||||
"text": "New York",
|
||||
"place_name": "New York, New York, United States",
|
||||
"bbox": [
|
||||
-74.2590879797556,
|
||||
40.477399,
|
||||
-73.7008392055224,
|
||||
40.917576401307
|
||||
],
|
||||
"center": [
|
||||
-73.9808,
|
||||
40.7648
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-73.9808,
|
||||
40.7648
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "district.12113562209855570",
|
||||
"wikidata": "Q500416",
|
||||
"text": "New York County"
|
||||
},
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "district.12113562209855570",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"district"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q500416"
|
||||
},
|
||||
"text": "New York County",
|
||||
"place_name": "New York County, New York, United States",
|
||||
"bbox": [
|
||||
-74.047227,
|
||||
40.682932,
|
||||
-73.907,
|
||||
40.879278
|
||||
],
|
||||
"center": [
|
||||
-74,
|
||||
40.7167
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-74,
|
||||
40.7167
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY",
|
||||
"text": "New York"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "region.17349986251855570",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"region"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q1384",
|
||||
"short_code": "US-NY"
|
||||
},
|
||||
"text": "New York",
|
||||
"place_name": "New York, United States",
|
||||
"bbox": [
|
||||
-79.8578350999901,
|
||||
40.4771391062446,
|
||||
-71.7564918092633,
|
||||
45.0239286969073
|
||||
],
|
||||
"center": [
|
||||
-75.4652471468304,
|
||||
42.751210955
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-75.4652471468304,
|
||||
42.751210955
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"country"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us"
|
||||
},
|
||||
"text": "United States",
|
||||
"place_name": "United States",
|
||||
"bbox": [
|
||||
-179.9,
|
||||
18.8163608007951,
|
||||
-66.8847646185949,
|
||||
71.4202919997506
|
||||
],
|
||||
"center": [
|
||||
-97.9222112121185,
|
||||
39.3812661305678
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-97.9222112121185,
|
||||
39.3812661305678
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"attribution": "NOTICE: © 2021 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained. POI(s) provided by Foursquare."
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"query": [
|
||||
"xjiebrbcidksn"
|
||||
],
|
||||
"features": [],
|
||||
"attribution": "NOTICE: © 2021 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained. POI(s) provided by Foursquare."
|
||||
}
|
||||
@ -0,0 +1,341 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"query": [
|
||||
-87.63380599999999,
|
||||
41.8299365
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"id": "poi.128849020577",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"poi"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q633613",
|
||||
"category": "baseball stadium, baseball, leisure",
|
||||
"landmark": true,
|
||||
"address": "333 W 35th St",
|
||||
"foursquare": "40dcbc80f964a52080011fe3"
|
||||
},
|
||||
"text": "Guaranteed Rate Field",
|
||||
"place_name": "Guaranteed Rate Field, 333 W 35th St, Chicago, Illinois 60616, United States",
|
||||
"center": [
|
||||
-87.63380599999999,
|
||||
41.8299365
|
||||
],
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
-87.63380599999999,
|
||||
41.8299365
|
||||
],
|
||||
"type": "Point"
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.33950",
|
||||
"text": "Bridgeport"
|
||||
},
|
||||
{
|
||||
"id": "postcode.11036815072354260",
|
||||
"text": "60616"
|
||||
},
|
||||
{
|
||||
"id": "place.1924128844701850",
|
||||
"wikidata": "Q1297",
|
||||
"text": "Chicago"
|
||||
},
|
||||
{
|
||||
"id": "district.8754923997749290",
|
||||
"wikidata": "Q108418",
|
||||
"text": "Cook County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "neighborhood.33950",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"neighborhood"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {},
|
||||
"text": "Bridgeport",
|
||||
"place_name": "Bridgeport, Chicago, Illinois 60616, United States",
|
||||
"bbox": [
|
||||
-87.665847,
|
||||
41.823142,
|
||||
-87.630759,
|
||||
41.849457
|
||||
],
|
||||
"center": [
|
||||
-87.6512,
|
||||
41.8381
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-87.6512,
|
||||
41.8381
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "postcode.11036815072354260",
|
||||
"text": "60616"
|
||||
},
|
||||
{
|
||||
"id": "place.1924128844701850",
|
||||
"wikidata": "Q1297",
|
||||
"text": "Chicago"
|
||||
},
|
||||
{
|
||||
"id": "district.8754923997749290",
|
||||
"wikidata": "Q108418",
|
||||
"text": "Cook County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "postcode.11036815072354260",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"postcode"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {},
|
||||
"text": "60616",
|
||||
"place_name": "Chicago, Illinois 60616, United States",
|
||||
"bbox": [
|
||||
-87.6466359591625,
|
||||
41.8272291061023,
|
||||
-87.592612118742,
|
||||
41.8674338954049
|
||||
],
|
||||
"center": [
|
||||
-87.62,
|
||||
41.86
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-87.62,
|
||||
41.86
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "place.1924128844701850",
|
||||
"wikidata": "Q1297",
|
||||
"text": "Chicago"
|
||||
},
|
||||
{
|
||||
"id": "district.8754923997749290",
|
||||
"wikidata": "Q108418",
|
||||
"text": "Cook County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "place.1924128844701850",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"place"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q1297"
|
||||
},
|
||||
"text": "Chicago",
|
||||
"place_name": "Chicago, Illinois, United States",
|
||||
"bbox": [
|
||||
-87.9058109309507,
|
||||
41.6299229800457,
|
||||
-87.523686109734,
|
||||
42.0234323628388
|
||||
],
|
||||
"center": [
|
||||
-87.6244,
|
||||
41.8756
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-87.6244,
|
||||
41.8756
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "district.8754923997749290",
|
||||
"wikidata": "Q108418",
|
||||
"text": "Cook County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "district.8754923997749290",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"district"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q108418"
|
||||
},
|
||||
"text": "Cook County",
|
||||
"place_name": "Cook County, Illinois, United States",
|
||||
"bbox": [
|
||||
-88.263641,
|
||||
41.469705,
|
||||
-87.523907,
|
||||
42.154292
|
||||
],
|
||||
"center": [
|
||||
-87.71667,
|
||||
41.8
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-87.71667,
|
||||
41.8
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"region"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL"
|
||||
},
|
||||
"text": "Illinois",
|
||||
"place_name": "Illinois, United States",
|
||||
"bbox": [
|
||||
-91.5130799991365,
|
||||
36.9702970055306,
|
||||
-87.0117177165746,
|
||||
42.553081292589
|
||||
],
|
||||
"center": [
|
||||
-89.2749461071049,
|
||||
40.1492928594
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-89.2749461071049,
|
||||
40.1492928594
|
||||
]
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"country"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us"
|
||||
},
|
||||
"text": "United States",
|
||||
"place_name": "United States",
|
||||
"bbox": [
|
||||
-179.9,
|
||||
18.8163608007951,
|
||||
-66.8847646185949,
|
||||
71.4202919997506
|
||||
],
|
||||
"center": [
|
||||
-97.9222112121185,
|
||||
39.3812661305678
|
||||
],
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
-97.9222112121185,
|
||||
39.3812661305678
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"attribution": "NOTICE: © 2021 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained. POI(s) provided by Foursquare."
|
||||
}
|
||||
@ -0,0 +1,305 @@
|
||||
{
|
||||
"type": "FeatureCollection",
|
||||
"query": [
|
||||
"portillos"
|
||||
],
|
||||
"features": [
|
||||
{
|
||||
"id": "poi.627065251624",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"poi"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"foursquare": "4b5b4c55f964a5209ff228e3",
|
||||
"landmark": true,
|
||||
"address": "635 W North Ave",
|
||||
"category": "burger joint"
|
||||
},
|
||||
"text": "Portillo's",
|
||||
"place_name": "Portillo's, 635 W North Ave, Villa Park, Illinois 60181, United States",
|
||||
"center": [
|
||||
-87.994203,
|
||||
41.904793
|
||||
],
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
-87.994203,
|
||||
41.904793
|
||||
],
|
||||
"type": "Point"
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.277661",
|
||||
"text": "South Addison"
|
||||
},
|
||||
{
|
||||
"id": "postcode.5355712630239150",
|
||||
"text": "60181"
|
||||
},
|
||||
{
|
||||
"id": "place.14963076574860490",
|
||||
"wikidata": "Q1863204",
|
||||
"text": "Villa Park"
|
||||
},
|
||||
{
|
||||
"id": "district.7716179127556280",
|
||||
"wikidata": "Q109626",
|
||||
"text": "DuPage County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "poi.472446436443",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"poi"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"foursquare": "4b099068f964a520811923e3",
|
||||
"landmark": true,
|
||||
"address": "155 S Il Route 83",
|
||||
"category": "hot dog, fast food"
|
||||
},
|
||||
"text": "Portillo's",
|
||||
"place_name": "Portillo's, 155 S Il Route 83, Elmhurst, Illinois 60126, United States",
|
||||
"center": [
|
||||
-87.962508,
|
||||
41.895473
|
||||
],
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
-87.962508,
|
||||
41.895473
|
||||
],
|
||||
"type": "Point"
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.287059",
|
||||
"text": "Elmhurst City Centre"
|
||||
},
|
||||
{
|
||||
"id": "postcode.14277643230845500",
|
||||
"text": "60126"
|
||||
},
|
||||
{
|
||||
"id": "place.10834168015713210",
|
||||
"wikidata": "Q579542",
|
||||
"text": "Elmhurst"
|
||||
},
|
||||
{
|
||||
"id": "district.7716179127556280",
|
||||
"wikidata": "Q109626",
|
||||
"text": "DuPage County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "poi.89343",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"poi"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"foursquare": "4a293d31f964a52071951fe3",
|
||||
"landmark": true,
|
||||
"address": "1500 Butterfield Rd",
|
||||
"category": "fast food",
|
||||
"maki": "fast-food"
|
||||
},
|
||||
"text": "Portillo's",
|
||||
"place_name": "Portillo's, 1500 Butterfield Rd, Downers Grove, Illinois 60515, United States",
|
||||
"center": [
|
||||
-88.022488,
|
||||
41.834394
|
||||
],
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
-88.022488,
|
||||
41.834394
|
||||
],
|
||||
"type": "Point"
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.272377",
|
||||
"text": "Highland Hills"
|
||||
},
|
||||
{
|
||||
"id": "postcode.10443155941018200",
|
||||
"text": "60515"
|
||||
},
|
||||
{
|
||||
"id": "place.13768728440893640",
|
||||
"wikidata": "Q1007011",
|
||||
"text": "Downers Grove"
|
||||
},
|
||||
{
|
||||
"id": "district.7716179127556280",
|
||||
"wikidata": "Q109626",
|
||||
"text": "DuPage County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "poi.549755920662",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"poi"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"foursquare": "4ae88c30f964a52053b021e3",
|
||||
"landmark": true,
|
||||
"address": "235 E North Ave",
|
||||
"category": "hot dog, fast food"
|
||||
},
|
||||
"text": "Portillo's",
|
||||
"place_name": "Portillo's, 235 E North Ave, Glendale Heights, Illinois 60139, United States",
|
||||
"center": [
|
||||
-88.08045,
|
||||
41.902269
|
||||
],
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
-88.08045,
|
||||
41.902269
|
||||
],
|
||||
"type": "Point"
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.32979",
|
||||
"text": "Shorewood"
|
||||
},
|
||||
{
|
||||
"id": "postcode.7546533656837130",
|
||||
"text": "60139"
|
||||
},
|
||||
{
|
||||
"id": "place.10354477397635860",
|
||||
"wikidata": "Q912145",
|
||||
"text": "Glendale Heights"
|
||||
},
|
||||
{
|
||||
"id": "district.7716179127556280",
|
||||
"wikidata": "Q109626",
|
||||
"text": "DuPage County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id": "poi.755914248504",
|
||||
"type": "Feature",
|
||||
"place_type": [
|
||||
"poi"
|
||||
],
|
||||
"relevance": 1,
|
||||
"properties": {
|
||||
"foursquare": "4b44c97ff964a5202cfc25e3",
|
||||
"landmark": true,
|
||||
"address": "100 W Lake St",
|
||||
"category": "hot dog, fast food"
|
||||
},
|
||||
"text": "Portillo's",
|
||||
"place_name": "Portillo's, 100 W Lake St, Addison, Illinois 60101, United States",
|
||||
"center": [
|
||||
-87.991471,
|
||||
41.933674
|
||||
],
|
||||
"geometry": {
|
||||
"coordinates": [
|
||||
-87.991471,
|
||||
41.933674
|
||||
],
|
||||
"type": "Point"
|
||||
},
|
||||
"context": [
|
||||
{
|
||||
"id": "neighborhood.287037",
|
||||
"text": "Michael Lane Area"
|
||||
},
|
||||
{
|
||||
"id": "postcode.16750824071334230",
|
||||
"text": "60101"
|
||||
},
|
||||
{
|
||||
"id": "place.12939236967422170",
|
||||
"wikidata": "Q353080",
|
||||
"text": "Addison"
|
||||
},
|
||||
{
|
||||
"id": "district.7716179127556280",
|
||||
"wikidata": "Q109626",
|
||||
"text": "DuPage County"
|
||||
},
|
||||
{
|
||||
"id": "region.10854263468358810",
|
||||
"wikidata": "Q1204",
|
||||
"short_code": "US-IL",
|
||||
"text": "Illinois"
|
||||
},
|
||||
{
|
||||
"id": "country.19678805456372290",
|
||||
"wikidata": "Q30",
|
||||
"short_code": "us",
|
||||
"text": "United States"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"attribution": "NOTICE: © 2021 Mapbox and its suppliers. All rights reserved. Use of this data is subject to the Mapbox Terms of Service (https://www.mapbox.com/about/maps/). This response and the information it contains may not be retained. POI(s) provided by Foursquare."
|
||||
}
|
||||
Loading…
Reference in New Issue