When you post a regular status update to Facebook, it tracks your current location and gives the (near) city next to the time. I.e.: May 24 near New York City, New York. Please note that this is not a check-in.
I'm trying to do the same, without searching for a page (place) id and checkin.
I've tried posting the coordinates with latitute and longitute, but it doesn't show the near city.
https://graph.facebook.com/me/feed
message=test
coordinates={"latitude": 37.4163458217, "longitude": -122.15198690595}
please check this url
https://developers.facebook.com/docs/reference/api/status/
you have to pass the coordinates as an object called place , and that will have the details about the place , few more details about place object ...
object containing id and name of Page associated with this location, and a location field containing geographic information such as latitude, longitude, country, and other fields (fields will vary based on geography and availability of information)
I realize this is an old question, but just to confirm, posting via an app can only let you tag a place using the place ID.
Please check these related posts -
https://developers.facebook.com/blog/post/2012/03/07/building-better-stories-with-location-and-friends/
https://developers.facebook.com/docs/opengraph/actions/#taggingplaces
Related
I'm stuck on how to approach the design of this problem - or even how to search for answers. I'm still a bit new with Django. The goal is to have a user select one or more locations (libraries in my problem) from a list of locations. I'd like the user to be able to type in an address and then have the list of locations filter based on distance between the locations. I envision the list of locations to be selection field. I'm assuming there will be an input field for the distance (canned choices or just a whole number) and a button to apply the filter.
I know how to get the user's location (as a postal address) converted to lat/long using py-geocoder. I have the lat/long of each library. I know how to calculate the distance between two points (py-haverstine or maybe geometry-distance).
Where this seems squirrely is the mechanics of filtering the list. How would I do the "filter" action (submit) versus the "save" action if I'm using a model based view? So far, when I hit the server, I've been processing the form as a submission, not a portion.
Or would this be better done client-side as js (which I don't know, but I assume someone has done this already)?
So far I have this code:
with open("real estate data.csv", "a") as myfile:
myfile.write('"{0}",'.format((tweets.user.location).encode('utf8')))
Which can find me the location of users on the Twitter API when they make a Tweet.
However, it returns broad locations such as New York, but what if I wanted to find specific cities or areas, like Times Square, New York instead of all of New York.
The latitude and longitude coordinates are specified under the coordinates field, however those coordinates are only specified in case the user explicitly shared their location while tweeting.
To access it simply use tweet.coordinates, here is an example:
"coordinates":[-97.51087576,35.46500176]
Read more about coordinates in the doc.
This used to be part of the geo field which is deprecated now so it will always be equal to null.
Read more about how geolocation works within the Twitter API here.
I have a Stream Analytics job that generates locations latitude and longitude to powerbi. I am trying to create a map on powerbi.com from these locations. I am creating a map diagram and adding latitude and longitude fields to maps latitude and longitude fields. But nothing is generated. It is expecting some Location field as well. What data should I provide there?
Yes. You need something in the Location field (but it can be a timestamp or an ID or anything). That's what decides how many bubbles you have. Then for each bubble it does an average latitude and longitude to determine where to put the bubble.
The location field is to specify a "City" location rather then specifying it giving coordinates. If you provide "London" for instance it will create the shapes at the center of London as defined in the maps provider.
On the Long and Lat side, they have to be in a specific format for PBi to recognize them as map fields.
Take a look at the links below for further info on how to change the data type using the editor.
http://community.powerbi.com/t5/Desktop/How-to-map-latitude-longitude/td-p/2479
http://www.radacad.com/how-to-do-power-bi-mapping-with-latitude-and-longitude-only
Hope this helps.
I am working with Facebook graph api for few days. I am trying to extract user's status and the information of reshared if any. I can easily find status of a user using fields=id,name,statuses query. But I could not find any information about re-sharing. I found a field of status sharedposts. But could not understand what it actually does. Can anyone enlighten me about how can I collect information about resharing (who reshared,when reshared,resharing location). I used user_status access token.
The sharedposts field applies to a status id. For example, the status id 10151794781777494 is from a status update by the TheKrazyCouponLady which has been shared 4 times. This query:
/10151794781777494?fields=sharedposts
Will return all the information about the users that have shared it. If you want to limit the returned fields to the name and id of the sharer, and the time and location it was shared, you could do this:
/10151794781777494?fields=sharedposts.fields(from,created_time,place)
Although I expect there won't be any location data most of the time.
To find the status id in the first place, you could just query the statuses field for a particular user. Again, using TheKrazyCouponLady (uid 255919387493) as an example:
/255919387493?fields=statuses
To get just the ids:
/255919387493?fields=statuses.fields(id)
As an alternative to that, you may want to consider querying the user's posts instead. The advantage to using posts, is that you can get back the share count for each post in that query.
/255919387493?fields=posts.fields(id,shares)
If the share count on a post is zero, then there is obviously no need to run another query to retrieve the users that have shared that post.
The downside of using posts is that the post id is slightly different from a status id. You'll see ids that look like this:
255919387493_10151794781777494
The first half of that string is the user id of the post owner. The second half is the actual status id. If you want to query the sharedposts field for the post, you first have to extract the second half (the status id) and use that for the query.
Having said that, it occurs to me that you could actually retrieve all the information you need in one go if you chain the statuses query and the sharedposts query together. For example, something like this:
/255919387493?fields=statuses.fields(id,message,sharedposts.fields(from,created_time,place))
That will return the status id and message text for each status from that user, and the user details, create time and location for each person that shared each of those statuses.
Even with paging, though, that is likely to be a fairly slow query, so I'm not sure if that's such a good idea. It's worth considering though.
According new version of API 2.1 and documentation from here
https://developers.facebook.com/docs/graph-api/reference/v2.1/post
there is a new edge called "sharedposts"
As described here https://developers.facebook.com/docs/graph-api/reference/v2.1/object/sharedposts
This reference describes the /sharedposts edge that is common to
multiple Graph API nodes. The structure and operations are the same
for each node.
This edge represents any posts where the original object was shared on
Facebook.
If the post type is photo sharedposts will return empty as the object is different to the postID
/317380948302131_847979698575584 => Object : 847979378575616
/317380948302131_847979698575584/sharedposts?fields=from,via
ObjectID will work as expected
/847979378575616//sharedposts?fields=from,via
The only problem if the object is a shared_post it will show all shares from the original post object too and no via node is present .
Just struggle around some time why the APi only sometimes return sharedposts
I am a bit stuck on how I should model this out.
Here is what I have:
I have a model called Location. In this model I have postal code, city, region, longitude, and latitude. This data is pre-populated with all of Canada's stuff. You can imagine this table is quite large.
This is what I would like to achieve by stuck on how to model this:
I would like to create a second model called Item. Each one of these items will need to be tied to a location from the said above model. The user-story would be as follows:
User adds an item: I already know their postal code and city based on their cookie that I set.
User submits the form with their item: this is where I am confused as to how to model this data so that the item gets saved in the proper location.
I figured a FK would be the way to go but that is waaaaay to inefficient for a number of obvious reasons (huge list, and requires user input but I already know their location before saving). So, since I already know their location based on their cookie, should create a new field in the Item model called location and just save the postal code in this model? If I did this I guess I would have to query the location model for that location to pull in proper info. I am not sure what the best to go about this is, please help.
If you already know the user's location, and they're just entering an item, then the Item model should have a foreign key to Location, but you don't prompt for it on the form. Instead, fill in the Location before you save the item.
If you're using a ModelForm, then you'll want to exclude your location field so that it isn't displayed. You'll also want to set commit=False so that you can fill in the location yourself before saving the form data to the Item table.