3

I am using Tweepy and Psycopg2 to extract tweets and input them in a PostgreSQL table. When I try to insert the point of the tweet I succeed in creating a point in the geom column I create. I however do not succeed in getting a basemap aligned behind it, while I thought I had the tweets in SRID=4326 which is WGS84.

Is there something wrong with my script? I suppose the basemap is not wrong but I can't be sure.

cur.execute("SELECT AddGeometryColumn('public', 'test', 'geom', 4326, 'POINT', 2)")
cur.execute("INSERT INTO Test(geom) VALUES(ST_SetSRID(ST_MakePoint(%s,%s),4326))",(tweet.coordinates['coordinates'][0],tweet.coordinates['coordinates'][1]))
        con.commit()

Or are Tweepy points just not in WGS84? I thought they were.

*** update This is my search statement

for tweet in tweepy.Cursor(api.search, q="*",since="2016-02-10", until="2016-02-29", count=100000, geocode="5.29126,52.132633,150km").items(10000000):

Expecting the tweets to be in the Netherlands and parts of Belgium and Germany.

I did make some steps getting tweets in Belgium on the right location. But it's still weird. I load in a basemap in EPSG::3857 and then need to put the tweets on EPSG::4326 and they align. When I put them in the same CRS they do not align.

1
  • Can you give a sample of the tweet.coordinates parameter that you're having trouble with? Like you I'm pretty sure that the coordinates from twitter are simply WGS84 longitude/latitude. Also, are you using streaming or searching to get the tweets with coordinates?
    – om_henners
    Feb 29, 2016 at 5:53

1 Answer 1

1

I've created a plugin for QGIS called twitter2qgis which fetches data from twitter firehorse. The coordinates in tweets are in EPSG:4326 if they are provided.. and the geocode must be in lat,lon,radius. Yours are in lon,tat,radius:

geocode="5.29126,52.132633,150km" --> geocode="52.132633,5.29126,150km"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.