How to Capture Precise location (lon/Lat) of the tweets



Hi, Im medical doctor and I want to use twitter as community hazards reporting tool. So health staff will tweet me with the information with precise location . I want to know how can I view their longitude and latitude data in the tweet. Please share me the available documents. you help is very much appreciated. Thank you


Maybe using this: - it’ll get 20 tweets at a time (you can page through them with the since_id and max_id fields). Looking at the results, you can get the geo information if it’s provided. Not all tweets will have a location attached.


This is straightforward, as long as the users Tweeting you opt-in to sharing their precise location in the Tweet (very few users do this, but you could make it an encouraged part of your application flow - you cannot force users to share their location information and must not tag Tweets with geodata without the users’ permission).

Geo information is inside the Tweet JSON object in the coordinates object.


Hi DanielCHood and andypiper thanks lot for reply. I can get the precise location from my health staff. Now I want to capture it from my end to our mysql database[quote=“andypiper, post:3, topic:67452”]
Tweet JSON object in the coordinates object.

This may be very basic question please excuse about it . Kindly tell me exactly how I can capture these coordinate object and insert in to the mysql database. It’s great if you can share basic documentation to develop this kind of api.
Thank again


Both of the previous responses link to the basic Twitter API documentation you need - in essence, you’d look into your mentions timeline, and then for each Tweet, extract the coordinates from the JSON. After that, it is up to you how and what you store in your database. We really can’t provide a lot more detail as it depends on your coding and runtime environments of choice.