I am trying to use a full address with venue search and not having much luck.
Passing the string 'brooklyn NY 11201' via the near param returns a list of venues in the 11201 area code.
Passing the string '22 Jay St, Brooklyn NY 11201' via the near param returns a failed geocode error.
The near, client_id, and client_secret params are the only params I am passing. Is there something else that I need to get the foursquare geocoder to work, or does it just not accept specific addresses?
Unfortunately, the Foursquare geocoder doesn't support the conversion of fine street addresses very well. City- or zip code-level granularity will be your best bet.
Related
I just started tinkering with Tweepy to see the extent of what's possible, and I'm wondering if I can grab a user's description (the short bio on their profile, under the handle) directly. I know the description can be accessed by using a workaround like this:
api = tweepy.API(auth)
pastrytweet = api.search('pastries')
for twit in pastrytweet:
print(twit)
This gives us an output that is a list (not in the Python sense) of Status objects, each of which contains a ton of information, eg:
Status(_api=<tweepy.api.API object at 0x038F6EF8>, _json={'created_at': 'XXXXXXXXXXX', 'id': XXXXXXXXXXXX, 'id_str': 'XXXXXXXXXXX', 'text': 'RT #XXXXXXXXXXX XXXXXX pastries XXXXXX', 'description': 'XXXXXXXXX')
I'm trying to access this "description" parameter seen here at the end directly, but any attempt I make returns a "AttributeError: 'Status' object has no attribute 'description'".
So if I wanted, say, to search for a term and grab the bio of a user that published a tweet with that term for some reason, how would I proceed? Or even to search people's bios directly? Is it even possible? I read the Tweepy documentation and I didn't really find an answer.
Each status object return by api.search has an attribute user and under user you'll find the description. The following code should help:
api = tweepy.API(auth)
pastrytweet = api.search('pastries')
for twit in pastrytweet:
print(twit.user.description)
For the Universal Windows Platform (UWP) MapControl, I want to plot a street address. Unfortunately, as far as I know, the control only accepts Geopoint locations for Center.
Ex:
myMap.Center =
new Geopoint(new BasicGeoposition()
{
//Geopoint for Seattle
Latitude = 47.604,
Longitude = -122.329
});
How do I convert a street address to a Geopoint location and back again? Is there another way to plot street addresses?
Thanks for your help.
To convert a street address to a Geopoint location and back again, you can use the MapLocationFinder.FindLocationsAsync and MapLocationFinder.FindLocationsAtAsync method.
Convert addresses to geographic locations (geocoding) and convert geographic locations to addresses (reverse geocoding) by calling the methods of the MapLocationFinder class in the Windows.Services.Maps namespace.
For more info, see Perform geocoding and reverse geocoding.
If you search on amazon for, say, "Don Quixote Spanish/English" you will find a number of matches or near-matches at http://www.amazon.com/s/ref=nb_sb_noss_2?url=search-alias%3Daps&field-keywords=Don%20Quixote%20Spanish%2FEnglish
You can then select any of them, and the URL will contain a designator (ASIN) for the product. For example, if you select a particular item in the result set, its URL might be:
http://www.amazon.com/Don-Quixote-Spanish-English-Complete-ebook/dp/B00JQRGICM/ref=sr_1_4?ie=UTF8&qid=1405527063&sr=8-4&keywords=Don+Quixote+Spanish%2FEnglish
The key piece of data here is the ASIN ("B00JQRGICM"); if you google using that alone, it will find many places where that product is referenced on the Internet.
My question is, does amazon provide an API whereby you can pass a search phrase (such as "Don Quixote Spanish/English") that will return to you an array of ASINs and other relevant data ("B00JQRGICM" and others)?
For example, I would like to call it something like this:
api/Books?SearchStr=Don Quixote Spanish/English
...and get back json such as:
{
Title: "Don Quixote in Spanish and English: Complete (Vol I & Vol II)"
Price: 16.15
ASIN: "B00JQRGICM"
Image: "http://ecx.images-amazon.com/images/I/519dhx-MSOL._SL160_.jpg"
}
. . .
If there is such an API, has anybody here got experience in using it/sample code?
Yes. You can search Amazon and get an XML response with the ASINs using the ListMatchingProducts operation of the MWS Products API.
Here's the documentation with a sample request & response:
http://docs.developer.amazonservices.com/en_US/products/Products_ListMatchingProducts.html
An easy way to test this is using the MWS Scratchpad: https://mws.amazonservices.com/scratchpad/index.html
I am using Gdirections google API. In that I am required to pass longitude and latitude in load method as parameters of source and destination. But when I pass longitude and latitude as parameters, it gives me a map with wrong directions. But when I pass source and destination address it gives me correct map.
How can I get a map with correct driving directions when lat and long is passed?
Here is one example of usage...
try below thing
gdir.loadFromWaypoints(["New Y...#40.714490,-74.007130", "NewJer...#40.072410,-74.728565"]);
Change New York and NewJer.. With the city or state you want..
Let me know it works for you or not.. Hope it helps..
Using the Foursquare Merchant API, I'm trying to add a campaign. I am able to add a special successfully. However, when using the special's id and adding a campaign, I receive the following error, "Foursquare2::APIError: other: No venues or groups specified. (400)".
Even after specifying both the specialId and venueId, I receive the same error. Although the foursquare docs state that only the specialId is required.
I am using the Foursquare2 ruby wrapper gem with my code additions to add a campaign
def add_campaign(options={})
response = connection.post do |req|
req.url "campaigns/add", options
end
return_error_or_body(response, response.body.response.campaign)
end
Having receiving a client object from the foursquare gem. I use the below code
client.add_campaign(:specialId => specialId, :venueId => venueId)
Any thoughts on why this is causing an error?
venueIds and groupIds are not individually required, but one of them must be provided. I'll update the documentation to make this clearer. Thanks for pointing this out!