sergey
Posts: 0
Joined: Fri May 30, 2014 6:23 pm

Twitter coordinates mapping to googlemaps

I barely started in appery and after I did the tutorial on twitter search I run into a small problem. I want to add more info to show in the search results, such as a tweet geo location in google maps (with a separate map for each result). But the coordinates are stored in the search response as an array, which in turn is a part of an object (e.g. geo). I can unwrap the object with coordinates, but I don't know how to pass these coordinates to the map. They come as an array of two numbers, but the map needs two separate numbers. There must be a simple way to pass them. Please help me out. Thanks a lot.
SF

sergey
Posts: 0
Joined: Fri May 30, 2014 6:23 pm

Twitter coordinates mapping to googlemaps

Thanks Eugene. I've actually started this tutorial on my own, but right now for some reason I'm not able to create a database service (it is a part of this exercise). I don't think it's the problem on my end, because I played around somewhat successfully with databases before. So in the meantime, could you point me on a part in this tutorial that may be particularly helpful?

sergey
Posts: 0
Joined: Fri May 30, 2014 6:23 pm

Twitter coordinates mapping to googlemaps

The database service is working now, The tutorial example with multimaps works too. But it didn't get me much closer to what I need. I looked at other examples too - they're not close enough either. It seems such an overkill to go through so much extra javascript to fish out a few bits of relevant information (all I need is to split a 2-number array). I think there should be an easier way to do this "trivial" mapping.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Twitter coordinates mapping to googlemaps

Hi Sergey,

To get correct coordinates you should add the following JavaScript code to coordinates mapping (https://dev.twitter.com/docs/platform...) for a map:prereturn value[0];/preandprereturn value[1];/prefor longitude and latitude accordingly.

sergey
Posts: 0
Joined: Fri May 30, 2014 6:23 pm

Twitter coordinates mapping to googlemaps

Thanks. I've actually tried it before and thought that it didn't work. But I've just realized that some of the search results don't have coordinates (i.e. a null object instead), which trips this code because it doesn't check if these fields exist. How do I check if value[0] and value[1] are returnable? Thanks again for helping out.

Return to “Issues”