Accessing the place image from Google Places for iOS - ios

I'm trying to grab the image of locations from Google Places. The JSON output is as follows, but I don't see how to access the image of each location. I want to put this image in a tablview with the listing for each place.
{
"html_attributions" : [
"Listings by \u003ca href=\"http://www.yellowpages.com.au/\"\u003eYellow Pages\u003c/a\u003e"
],
"results" : [
{
"geometry" : {
"location" : {
"lat" : -33.8719830,
"lng" : 151.1990860
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "677679492a58049a7eae079e0890897eb953d79b",
"name" : "Zaaffran Restaurant - BBQ and GRILL, Darling Harbour",
"rating" : 3.90,
"reference" : "CpQBjAAAAHDHuimUQATR6gfoWNmZlk5dKUKq_n46BpSzPQCjk1m9glTKkiAHH_Gs4xGttdOSj35WJJDAV90dAPnNnZK2OaxMgogdeHKQhIedh6UduFrW53wtwXigUfpAzsCgIzYNI0UQtCj38cr_DE56RH4Wi9d2bWbbIuRyDX6tx2Fmk2EQzO_lVJ-oq4ZY5uI6I75RnxIQJ6smWUVVIHup9Jvc517DKhoUidfNPyQZZIgGiXS_SwGQ1wg0gtc",
"types" : [ "restaurant", "food", "establishment" ],
"vicinity" : "Harbourside Centre 10 Darling Drive, Darling Harbour, Sydney"
},
{
"geometry" : {
"location" : {
"lat" : -33.8722580,
"lng" : 151.1986550
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/restaurant-71.png",
"id" : "27ea39c8fed1c0437069066b8dccf958a2d06f19",
"name" : "Criniti's Darling Harbour",
"rating" : 3.60,
"reference" : "CnRwAAAA-5kh5WZ3m1CMTO3LslvhRtAYsrOcQP7wB9AE1bV5R6Bd46NN5wB16MtImXWQ9eS1nWVbV_j-8iXYXRpU13Efp1t_d-Dp4WfEsFcYj-_g6db1SC1vAukyeCyotjS5xrwhzqWWAhgmA4qIliWeev2u1BIQprWzxl_hkj_w3QdTiUBYKxoUDVTjF4RugJdaJWkC4n6w6pSajKw",
"types" : [ "restaurant", "food", "establishment" ],
"vicinity" : "Shop 461, 2-10 Darling Drive, Harbourside Shopping Centre, DARLING HARBOUR"
},
...additional results...
],
"status" : "OK"
}
https://developers.google.com/maps/documentation/places/

The Google Places API does not currently support this feature. If you believe this would be a useful feature you can submit a 'Places API - Feature Request' here:
http://code.google.com/p/gmaps-api-issues/issues/entry?template=Places%20API%20-%20Feature%20Request

Related

JSON Creating Approach

I am working on an IOS project. I am trying to create Twitter. I am using Firebase Database. As you know Firebase uses JSON and i am confused about database creation.
First of all i have users with name, surname, email,username and profilepic URL.
Also i have posts which has a string named as post but as you know i need to show users in my post. A post object has its user's name, profilepic and username
And also users can follow another users and their timeline should have only posts sent by the users they follow.
This structure confuses me a lot here is a solution i have found and example of my json files
{
"users" : {
"1SUbzM6rIRTQexrOgJ8BnDBCDWt2" : {
"email" : "Test1#test.com",
"fullname" : "Test1 Test1",
"name" : "Test1",
"surname" : "Test1",
"username" : "#test1",
"ppurl" : "www.ppurl.com/ppppp",
"posts" : {}
},
"4vBvO9vURkPneusviRGxKglJ3n32" : {
"email" : "Test2#test.com",
"fullname" : "Test2 Test2",
"name" : "Test2",
"surname" : "Test2",
"username" : "#test2",
"ppurl" : "www.ppurl.com/ppppp",
"posts" : {
"34E20A52-8E66-4AF7-8DA4-73BDE9185FCB" : {
"post" : "Bir post daha\n"
},
"59798B81-4510-4E63-8050-3AF04698C7B0" : {
"post" : "3. Postumuz gör better approach"
}
},
"follows" : {
"5QaOU5Pd05h2M8wExcUteUg6mlJ2" : {
"email" : "TEST3#TEST.com",
"fullname" : "TEST3 TEST3",
"name" : "TEST3",
"surname" : "TEST3"
"username" : "#test3",
"ppurl" : "www.ppurl.com/ppppp",
"posts" : {}
},
"6y0RLGGCw6Zg5RHgPxghKUId9pJ3" : {
"email" : "TEST4#jjj.hhh",
"fullname" : "TEST4 TEST4",
"name" : "TEST4",
"surname" : "TEST4",
"username" : "#test4",
"ppurl" : "www.ppurl.com/ppppp",
"posts" : {}
},
},
},
"5QaOU5Pd05h2M8wExcUteUg6mlJ2" : {
"email" : "TEST3#TEST.com",
"fullname" : "TEST3 TEST3",
"name" : "TEST3",
"surname" : "TEST3"
"username" : "#test3",
"ppurl" : "www.ppurl.com/ppppp",
"posts" : {}
},
"6y0RLGGCw6Zg5RHgPxghKUId9pJ3" : {
"email" : "TEST4#jjj.hhh",
"fullname" : "TEST4 TEST4",
"name" : "TEST4",
"surname" : "TEST4"
"username" : "#test4",
"ppurl" : "www.ppurl.com/ppppp",
"posts" : {}
}
}
Is this a right approach? Users and posts duplicates and it is too hard to reach a data from the swift. Should i save posts different from users but if i do with this approach i cannot get post's username , name and ppurl etc.
How should i construct my JSON file and create relationships using the most efficient way.
Edit:
I can get my json files to my project. My question is : Is it true to write the same user 2-3 times ? I have a user already in my json file but when someone follows someone should i write it again inside of the friends attribute ? Or can i get reference with only id.
Why not use a simpler structure like this one:
{
"users": [
{
"identifier": "1SUbzM6rIRTQexrOgJ8BnDBCDWt2",
"email": "Test1#test.com",
"fullname": "Test1 Test1",
"name": "Test1",
"surname": "Test1",
"username": "#test1",
"ppurl": "www.ppurl.com/ppppp"
},
{
"identifier": "4vBvO9vURkPneusviRGxKglJ3n32",
"email": "Test2#test.com",
"fullname": "Test2 Test2",
"name": "Test2",
"surname": "Test2",
"username": "#test2",
"ppurl": "www.ppurl.com/ppppp",
"posts": [
"34E20A52-8E66-4AF7-8DA4-73BDE9185FCB",
"59798B81-4510-4E63-8050-3AF04698C7B0"
],
"follows": [
"5QaOU5Pd05h2M8wExcUteUg6mlJ2",
"6y0RLGGCw6Zg5RHgPxghKUId9pJ3"
]
},
{
"identifier": "5QaOU5Pd05h2M8wExcUteUg6mlJ2",
"email": "TEST3#TEST.com",
"fullname": "TEST3 TEST3",
"name": "TEST3",
"surname": "TEST3",
"username": "#test3",
"ppurl": "www.ppurl.com/ppppp"
},
{
"identifier": "6y0RLGGCw6Zg5RHgPxghKUId9pJ3",
"email": "TEST4#jjj.hhh",
"fullname": "TEST4 TEST4",
"name": "TEST4",
"surname": "TEST4",
"username": "#test4",
"ppurl": "www.ppurl.com/ppppp"
}
]
}
Otherwise you're JSON payload is going to grow bigger and bigger over time.
EDIT Just saw #vadian comment... Let's say it's based on his idea then.

How do I import GeoJSON files for use in Google Earth Engine Code Editor?

I have generated some points of interest with my database with SQL to geoJSON.
geojson:
{
"FeatureCollection" : [
{
"geometry" : {
"coordinates" : [
-45.927083,
-12.260889
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "626.46"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.916500,
-12.255944
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "565.04"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.949417,
-12.270361
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "631.47"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.958833,
-12.277361
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "591.85"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.942944,
-12.249889
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "644.67"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.930917,
-12.243611
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "644.67"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.871917,
-12.197139
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.866861,
-12.206417
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.967389,
-12.261889
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "592.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.973500,
-12.250639
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "592.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.962944,
-12.245444
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "621.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.952667,
-12.239778
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "592.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.931639,
-12.228528
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.908694,
-12.247472
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "557.20"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.918667,
-12.239139
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "644.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.897028,
-12.246000
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "557.20"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.906417,
-12.230472
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "64.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.895750,
-12.225028
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "644.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.927111,
-12.213750
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "564.90"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.917639,
-12.208750
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "564.90"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.897833,
-12.198444
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "584.00"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.881583,
-12.202233
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.876833,
-12.235306
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.867278,
-12.230306
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.856806,
-12.224889
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.861806,
-12.215611
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.887833,
-12.192806
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "12.60"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.877639,
-12.187917
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "564.90"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.941889,
-12.234611
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "644.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.887111,
-12.239889
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "644.50"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.907944,
-12.203361
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "591.70"
},
"type" : "Feature"
},
{
"geometry" : {
"coordinates" : [
-45.892722,
-12.208028
],
"type" : "Point"
},
"properties" : {
"grower" : "foo",
"name" : "bar",
"radius" : "574.60"
},
"type" : "Feature"
}
]
}
I would like to import this geojson to my code editor on Google Earth Engine. Looking in the docs (assets manager), GEE accepts assets as raster images, shapefiles (.shp, shx, dbf, prj).
Also, I found the import to feature collection via fusion tables, but it still needs shapefiles.
I have found some geojson to shapefile conversors, though I need a way to directly import my geojson to a feature collection on GEE. Is that possible?
You can also import GeoJSON geometry objects directly into either the JavaScript or Python API using, for example, this format for a MultiPolygon:
feature_geometry = {
"type": "MultiPolygon",
'coordinates": [
[
[
[-120, 35],
[-120.001, 35],
[-120.001, 35.001],
[-120, 35.001],
[-120, 35]
]
]
]
}
Both hash maps (i.e., dictionaries) are identical to the GeoJSON specification (source):
{
"type": "MultiPolygon",
"coordinates": [
[
[
[-120, 35],
[-120.001, 35],
[-120.001, 35.001],
[-120, 35.001],
[-120, 35]
]
]
]
}
Of course, you can also read this data in from a GeoJSON file (Python example shown):
import json
data = json.loads(geojson_file)
For a simple Python wrapper, there is the pygeoj library, but JSON data is handled well natively in Python and of course in JavaScript.
You can easily use OGR to convert your data a shapefile (which you can then upload through the code editor) or to KML and upload it into FusionTables.
ogr2ogr -f KML output.kml input.json
However, your FeatureCollection isn't valid GeoJSON and you'll have to fix that first. The preamble should look like:
{
"type": "FeatureCollection",
"features": [
{
"geometry" : { ...

Sorting Through NSData Results

I use a Web API from Spotify in my app to find a track by a particular artist within Spotify. The results look like this:
"tracks" : {
"href" : "https://api.spotify.com/v1/search?query=track%3A%22Dude+Looks+Like+A+Lady+%22+artist%3A%22+Aerosmith%22&offset=0&limit=1&type=track",
"items" : [ {
"album" : {
"album_type" : "album",
"available_markets" : [ "CA", "MX", "US" ],
"external_urls" : {
"spotify" : "https://open.spotify.com/album/3XYqOJI1YlX40kJTdzFEzp"
},
"href" : "https://api.spotify.com/v1/albums/3XYqOJI1YlX40kJTdzFEzp",
"id" : "3XYqOJI1YlX40kJTdzFEzp",
"images" : [ {
"height" : 640,
"url" : "https://i.scdn.co/image/948208cdb26864468ee4320070cd10e6b580d852",
"width" : 640
}, {
"height" : 300,
"url" : "https://i.scdn.co/image/087aeee7ed7b7397f5cf5a4c90bc0532d7a3319c",
"width" : 300
}, {
"height" : 64,
"url" : "https://i.scdn.co/image/562e9fa179952065137a17b175b5bca0647d5f47",
"width" : 64
} ],
"name" : "Permanent Vacation (Remastered)",
"type" : "album",
"uri" : "spotify:album:3XYqOJI1YlX40kJTdzFEzp"
},
"artists" : [ {
"external_urls" : {
"spotify" : "https://open.spotify.com/artist/7Ey4PD4MYsKc5I2dolUwbH"
},
"href" : "https://api.spotify.com/v1/artists/7Ey4PD4MYsKc5I2dolUwbH",
"id" : "7Ey4PD4MYsKc5I2dolUwbH",
"name" : "Aerosmith",
"type" : "artist",
"uri" : "spotify:artist:7Ey4PD4MYsKc5I2dolUwbH"
} ],
"available_markets" : [ "CA", "MX", "US" ],
"disc_number" : 1,
"duration_ms" : 265773,
"explicit" : false,
"external_ids" : {
"isrc" : "USIR10000454"
},
"external_urls" : {
"spotify" : "https://open.spotify.com/track/6gQUbFwwdYXlKdmqRoWKJe"
},
"href" : "https://api.spotify.com/v1/tracks/6gQUbFwwdYXlKdmqRoWKJe",
"id" : "6gQUbFwwdYXlKdmqRoWKJe",
"name" : "Dude (Looks Like A Lady)",
"popularity" : 55,
"preview_url" : "https://p.scdn.co/mp3-preview/7d85766664041815e16b54eb014d3d120f883db8",
"track_number" : 5,
"type" : "track",
"uri" : "spotify:track:6gQUbFwwdYXlKdmqRoWKJe"
} ],
"limit" : 1,
"next" : "https://api.spotify.com/v1/search?query=track%3A%22Dude+Looks+Like+A+Lady+%22+artist%3A%22+Aerosmith%22&offset=1&limit=1&type=track",
"offset" : 0,
"previous" : null,
"total" : 7
}
The only part that I actually need is the FINAL external_urls line that looks like this:
"external_urls" : {
"spotify" : "https://open.spotify.com/track/6gQUbFwwdYXlKdmqRoWKJe"
},
As this is the one that contains the specific app. I have done about 100 tries with the Web API, and this is the way it always appears. So my question is HOW can I pull out JUST this one area?

Google places api Administrative_Area_level strange wrong format?

I'm using google places api to retrive information about some cities that users can select with an autocomplete UItableview.
My first Request give me a list of cities and locality,starting from the search string:
https://maps.googleapis.com/maps/api/place/autocomplete/json?input=salo&types=(cities)&key=APIKEY
From the results list i take the place_id of "Salò" a city in Italy. With this id the second request:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJdf_ajleOgUcRGniBFh7H884&key=APIKEY
And this is the resulting json:
{
"html_attributions" : [],
"result" : {
"address_components" : [
{
"long_name" : "Salò",
"short_name" : "Salò",
"types" : [ "locality", "political" ]
},
{
"long_name" : "Salo'",
"short_name" : "Salo'",
"types" : [ "administrative_area_level_3", "political" ]
},
{
"long_name" : "Brescia",
"short_name" : "BS",
"types" : [ "administrative_area_level_2", "political" ]
},
{
"long_name" : "Lombardia",
"short_name" : "Lombardia",
"types" : [ "administrative_area_level_1", "political" ]
},
{
"long_name" : "Italia",
"short_name" : "IT",
"types" : [ "country", "political" ]
}
],
"adr_address" : "\u003cspan class=\"locality\"\u003eSalò\u003c/span\u003e \u003cspan class=\"region\"\u003eBS\u003c/span\u003e, \u003cspan class=\"country-name\"\u003eItalia\u003c/span\u003e",
"formatted_address" : "Salò BS, Italia",
"geometry" : {
"location" : {
"lat" : 45.60839199999999,
"lng" : 10.5104769
},
"viewport" : {
"northeast" : {
"lat" : 45.6146863,
"lng" : 10.5464998
},
"southwest" : {
"lat" : 45.59572439999999,
"lng" : 10.4992233
}
}
},
"icon" : "http://maps.gstatic.com/mapfiles/place_api/icons/geocode-71.png",
"id" : "f505830b9f7b6886f119df1b07bec0a6785940c7",
"name" : "Salò",
"place_id" : "ChIJdf_ajleOgUcRGniBFh7H884",
"reference" : "CnRtAAAAP9oklxjP8yqebLXhyFK0PM7l_w8zD8eBdNszf67rPHlckKnrhhs66eXZTYHfBiEizetRM8m7e8qxM6otVCX0QvxQ4jXgSv4VcH7NY2ZbYysboNplu8vaFs_BhITJ1MQJ-TunE9L-r1nBavhMLQRKNBIQqsKl1vt_pyqE_7Ow1aXp-hoU9jreecvh94V2ZpHT1JB-DxfoZEI",
"scope" : "GOOGLE",
"types" : [ "locality", "political" ],
"url" : "https://maps.google.com/maps/place?q=Sal%C3%B2+BS,+Italia&ftid=0x47818e578edaff75:0xcef3c71e1681781a",
"vicinity" : "Salò"
},
"status" : "OK"
}
From this json i need to extract the value from administrative_area_level_3 but i see something strange in accent, why the locality long_name value is "Salò" while the administrative_area_level_3 long_name value is "Salo'" ? What's the sense of this behaviour? In this way the administrative_area_level_3 results in the uilabel of my app as "Salo\'" even with utf8 encode/decode process...

How to develop combin charts of column and line with mutiple components in highcharts

I am struggling for the develop of combine charts of line and column with multiple components in highcharts.
Here each component has different x-axis values.Please help me out
thanks in advance
Generally mine exact question is ........................
first component:componentA
var y1-axis: [
{
"name" : "3D",
"type" : "line",
"data" : ["0","0","0"]
},
{
"name" : "3C",
"type" : "line",
"data" : ["0","0","0"]
},
{
"name" : "3B-NDT",
"type" : "line",
"data" : ["0","0","0"]
},
{
"name" : "3B",
"type" : "line",
"data" : ["0","0","0"]
}]
var x1-axis : [
{
"name" : "jobDescription",
"type" : "",
"data" : ["7799","1046","1112"]
}
]
Second component: componentB
var y2-axis: [
{
"name" : "3D",
"type" : "column",
"data" : ["0","7.98","0"]
},
{
"name" : "3C",
"type" : "column",
"data" : ["0","1.82","6.64"]
},
{
"name" : "3B-NDT",
"type" : "column",
"data" : ["0","48.12","37.87"]
}]
var x2-axis : [
{
"name" : "jobDescription1",
"type" : "",
"data" : ["7801", "1111", "1147"]
}
]
hw can design column chart with two components in single chart like
pls find the attached image of highchart
In general something like this is possible by using xAxis.left and xAxis.width like in this example: http://jsfiddle.net/45v24/4/
However, it looks like tooltip has bug, reported here.

Resources