Passing Longitude and Latitude in Twitter Streaming API of Pakistan

痴心易碎 提交于 2019-12-23 10:02:47

问题


I am having problem in passing longitude and latitude format of Pakistan in Twitter Streaming API. This API provides some sample examples of passing longitude and latitude of some cities. The location for San Fransisco in the API location example is given below and it works very well in my program.

-122.75,36.8,-121.75,37.8

But I am trying to use the following location to get tweets from Pakistan but the server rejects this location.

71.69,32.01,70.69,33.01

Kindly help me which 4 values separated by commas I should pass that will allow me to get tweets from Pakistan.


回答1:


Each bounding box should be specified as a pair of longitude and latitude pairs, with the southwest corner of the bounding box coming first.

Your co-ordinates of 71.69,32.01,70.69,33.01 give this (which only seems to be a small part of Pakistan, might want to have a larger box):

So I think you box isn't being formed correctly because you're not giving the bottom left (South West) corner of it first. In order to give the box co-ordinates correctly you need to have them in the format bottom-left-longitude, bottom-left-latitude, top-right-longitude, top-right-latitude.

Try using 70.7,32.1,71.7,33.1 (I've rounded the figures) instead which will give you the same area you suggested originally:

In order to get the whole of Pakistan try using: 62.9,25.2,73.3,35.2 which give you the area:

I use this website in order to get the latitude/longitude values. Note that the website gives you latitude, longitude but Twitter wants longitude, latitude. Remember to swap them around!



来源:https://stackoverflow.com/questions/16512878/passing-longitude-and-latitude-in-twitter-streaming-api-of-pakistan

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!