How do I get the location coordinates of a tweet that has been submitted from desktop computer?


#1

I’m trying to get the coordinates of user tweets. The problem is that there is no coordinates for tweets that have been submitted through desktop. When I post a tweet i specify the location but it doesn’t come up in the array.

On the other hand everything works fine when i submit a tweet from my phone.

I don’t know what’s wrong.


#2

Hello,

When Tweeting from your phone with exact GPS coordinates, you can indeed retrieve the location information from coordinates, with the inner coordinates array formatted as geoJSON (longitude first, latitude second), and a type with value Point.

When submitting an approximate location like a city or a neighborhood from your computer, you should look into the place nested object. Your can find here a Polygon as a type, an array of coordinates describing a bounding box for this location as well as its name, type, country, and more.

Check out the object documentation for [node:7286] to find more information.


#3

Hi!

Thanks a lot for the information and quick response. The thing is that I don’t have any place objects inside tweets array. There is nothing specifying anything in regards to a place.


#4

Could you please share the URL of the Tweet you are currently looking into and supposed to have location information?


#5

#6

you can go to the username @prankybird, the tweet is testtt3434 or test4


#7

I just had a look at the API response from this Tweet using:

$ twurl "/1.1/statuses/show/455461039371350016.json"

Here is the place attribute in the JSON response, with the details of the Toronto location as I described in my previous message:

{ ... "place": { "id": "8f9664a8ccd89e5c", "url": "https:\/\/api.twitter.com\/1.1\/geo\/id\/8f9664a8ccd89e5c.json", "place_type": "city", "name": "Toronto", "full_name": "Toronto, Ontario", "country_code": "CA", "country": "Canada", "contained_within": [], "bounding_box": { "type": "Polygon", "coordinates": [ [ [-79.639319, 43.403221], [-78.90582, 43.403221], [-78.90582, 43.855401], [-79.639319, 43.855401] ] ] }, "attributes": {} } }

Let us know if we can help further.


#8

Thanks a lot. I’ll look into this now.


#9

Hi!, When I attach a picture to the tweet i lose the place attribute using statuses/show. Is that normal?


#10

Hi!, When I attach a picture to the tweet i lose the place attribute using statuses/show. Is that normal?


#11

No, the place should still be here, whether or not the Tweet contains an image. Can you please share an example so we can confirm?


#12

Is this also available for direct messages?


#13

No, there’s no geo associated with DMs.


#14

Hey, I was think could we find the country this tweet was tweeted from? https://twitter.com/MarinaJoyce7/status/758072430145462273

I dont know if you have heard about all the “drama” that could have happend to her, but I was just thinking if we could know from wich country it was tweeted from.
Thanks, Marcus


#15

If a user does not explicitly choose to add location data to their Tweets then the location is not stored in any way.


#16