Hot answers tagged

22

I found a way using purely Python to get the coordinates for tweets using a word filter. It doesn't seem like many people include location with their tweets. This might not be what you're after either because this is live streaming data. You can test it by putting a unique filter word and then tweeting that word from your Twitter account. You will see your ...


8

Some places like Twitter connect geographical data with the content ("tweets" in this case). If you use the API to request a list of recent tweets, it will give you geographical data along with it ("coordinates", "geo" in the JSON response): Twitter API Example I suspect most of the data you're referring to is collected similarly. Basically, find a ...


7

Getting a location from a string is called Geocoding and there are a number of services offering that. The geocoder from the OpenStreetMap project is called Nominatim and is freely available, you could simply use the API: https://nominatim.openstreetmap.org/search?q=Berlin,+Germany&format=json ✔ https://nominatim.openstreetmap.org/search?q=TX&...


7

This achieves finding country given coordinates. https://github.com/che0/countries It uses a shapefile containing world borders loaded using python bindings for gdal. Example: import countries cc = countries.CountryChecker('TM_WORLD_BORDERS-0.3.shp') print cc.getCountry(countries.Point(49.7821, 3.5708)).iso The world borders shapefile can be obtained ...


7

Here's the entry from @underdark where she explains how to get geolocated tweets using curl. http://underdark.wordpress.com/2011/10/01/tweets-to-qgis/


5

There is nothing in your Question to suggest that you need to perform a conversion. Instead, I would try: point = osgeo.ogr.Geometry(osgeo.ogr.wkbPoint) point.SetPoint(0, 112.73091137, -7.2377761) The original values look like they are from a projected coordinate system whereas you appear to be receiving Twitter data in a geographic coordinate system but ...


5

You'll need to tap into the api's for twitter, flickr and youtube. twitter api: https://dev.twitter.com/docs/api/1.1 Discussion specific to twitter here (from 2010): https://stackoverflow.com/questions/4337319/how-to-search-only-for-geotagged-tweets Looking at the docs for twitter, you have to issue a get request to the api that includes a search location ...


4

When you view the details of the arcgis online app, if you select the Open button, you should get the choice to open in desktop.


4

I used to do this with curl as described here, but Twitter removed basic authentication support from public streaming endpoints on June 11, 2013, so you need to use OAuth. In order to do this you need to have a Twitter account and request an application. Below is a very simple example, written in Python using the twython library. from twython import ...


4

cartogram.js is a JavaScript implementation of an algoritm to construct continuous area cartograms.


4

I have looked at tweets to some extent. But not in your area. But I suspect this is down to two types of tweets. Actual tweets that fall into two categories. The correct geolocation with specific precision (see the tweets in the urban area), and town level geolocation (see the stacks in the urban area). Then you have automated tweets. These are the ones ...


4

The process you are attempting is called Geographic Information Retrieval (GIR), there are whole academic conferences about it. When I worked on this (~10 yrs ago) I collected some literature that may help you get started, for example papers I tagged GIR. Once you have extracted place names (toponyms) you need to disambiguate the place, and finally geocode ...


3

The geopy geocoder will return a None object if a location can't be geocoded. For example: >>> g = geocoders.Nominatim() >>> loc = g.geocode("This place doesn't exist") >>> type(loc) NoneType You'll need to take a look at the locations coming in from the user location, and probably through a try...except block around getting ...


3

By using CartoDB.js you can set sanitizeTemplate as false in order to run your scripts inside custom infowindows. An example: cartodb.createVis('map', 'viz_json', {options}) .done(function(vis, layers) { var d = layers[1].getSubLayer(0); d.infowindow.set({sanitizeTemplate:false}); d.infowindow.set("template", function(g) { ... });


3

For the moment CartoDB do not support javascript in infowindow templates. In the meantime you can take a look to this blogpost: http://blog.cartodb.com/introducing-social-infowindows-display-your-tweets-the/


2

Given that you only need to find what country the tweets are in I guess the VMAP0 data is sufficient. As for Python libraries I would recommend looking at Shapely, which supports the Shapely library, a turorial on point-in-polygon can be found here. As for reading in the country polygons from the vmap0-data (which i presume are polygons in shapefiles), you ...


2

It is a Leaflet plugin you can implement in any CartoDB map, you can find it here: https://github.com/joergdietrich/Leaflet.Terminator


2

Firstly, the error AttributeError: 'float' object has no attribute 'xcor' is self-explanatory. Python float objects do not have an xcor method or property. >>> print [a for a in dir(1.0) if not a.startswith('_')] ['as_integer_ratio', 'conjugate', 'fromhex', 'hex', 'imag', 'is_integer', 'real'] I'm not quite sure what you are doing with the ...


2

I tested your code and it works fine (I tested it on OSX, Python 2.7.) so I could not reproduce your error. Maybe you simply face internet connection problems? How long do you have to wait to get this error? You can add try-catch exception block in example here: while True: try: auth = OAuthHandler(consumer_key, consumer_secret) ...


1

for tweet in ts.search_tweets_iterable(tso): tweetText = ( '@%s tweeted: %s' % ( tweet['user']['screen_name'], tweet['text'] ) ).encode("ascii", "ignore") print tweetText if tweet['place'] is not None: (lat, lng) = geo(tweet['place']['full_name']) tw = tweet['text'] user= tweet['user']['screen_name']...


1

This would give you another option: Sampling Design Tool: The Sampling Design Tool for ArcGIS 10 provides a means to effectively develop sampling strategies.


1

You essentially want to perform geocoding. You can't go past geopy for this. You can pick from multiple providers, some of which require an authentication token and/or rate limit you. Depending on what you're doing with it, an interesting use is to query multiple providers and develop an estimate of error. Note that these all will reduce "North Carolina" to ...


1

CARTO UI does not allow to define real time twitter maps. As you correctly say they are defined once using a time span. To have near real time twitter maps you need to contact CARTO sales team as this is something custom we need to prepare on a case by case basis.


1

The main thing you need to do is declare your interactivity variables in your config file when you first create your named map. Here's an example of a named map with infowindows on specific variables: http://bl.ocks.org/ohasselblad/d1a45b8ff5e7bd90cd68 The config file is also on that page. It's based on earthquake data from here.


1

This may be a little too late, but the way I have been handling the bounding boxes is by using (X1+X2)/2, (Y1+Y2)/2 as my XY coordinates, and plotting those directly. That way I at least have an average coordinate set for the event. This way I am able to quickly produce coordinates without complex programming to "draw" bounding boxes since I mostly use ...


1

Textually from the Twitter API documentation If you would like to exclude place matches or only include places which fall completely within the bounding box, your code will have to perform an additional filtering step after reading the filtered stream.


1

"The world map certainly isn't in Mercator, but probably pseudo-Plate Carree (lat/lon just mapped as if they're linear units) or Plate Carree. Mercator stretches north-south, and you can see that the POIs are offset north and south versus the base map." [mkennedy] "@mkennedy has provided the diagnosis (your world map is not in a Mercator projection). ...


Only top voted, non community-wiki answers of a minimum length are eligible