本文整理了Java中twitter4j.GeoLocation.<init>()
方法的一些代码示例,展示了GeoLocation.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoLocation.<init>()
方法的具体详情如下:
包路径:twitter4j.GeoLocation
类名称:GeoLocation
方法名:<init>
[英]Creates a GeoLocation instance
[中]创建地理位置实例
代码示例来源:origin: stackoverflow.com
// creates a new query around [37.7832, -122.4056] with a radius of 0.6 kilometers
GeoQuery geoQuery = geoFire.queryAtLocation(new GeoLocation(37.7832, -122.4056), 0.6);
代码示例来源:origin: stackoverflow.com
geoFire.setLocation("firebase-hq", new GeoLocation(37.7853889, -122.4056973));
代码示例来源:origin: stackoverflow.com
geoFire.setLocation("firebase-hq", new GeoLocation(37.7853889, -122.4056973));
代码示例来源:origin: stackoverflow.com
geoFire.setLocation("firebase-hq", new GeoLocation(37.7853889, -122.4056973));
代码示例来源:origin: stackoverflow.com
public class PlaceInformation {
private String name;
private String tag;
private String address;
private double latitude;
private double longitude;
GeoLocation place = null;
public PlaceInformation(String name, String address, String tag,
double latitude, double longitude) {
this.name = name;
this.address = address;
this.tag = tag;
this.latitude = latitude;
this.longitude = longitude;
place = new GeoLocation(latitude, longitude);
}
代码示例来源:origin: stackoverflow.com
public class PlaceInformation {
private String name;
private String tag;
private String address;
private double latitude;
private double longitude;
GeoLocation place;
public PlaceInformation(String name, String address, String tag,
double latitude, double longitude) {
place = new GeoLocation(latitude, longitude);
this.name = name;
this.address = address;
this.tag = tag;
this.latitude = latitude;
this.longitude = longitude;
}
/* Rest of class omitted */
}
代码示例来源:origin: org.mule.modules/mule-module-twitter
private GeoQuery createQuery(Double latitude, Double longitude, String ip) {
if (ip == null) {
return new GeoQuery(new GeoLocation(latitude, longitude));
}
return new GeoQuery(ip);
}
代码示例来源:origin: stackoverflow.com
ipAddress = request.getRemoteAddr();
GeoLocation gl = new GeoLocation();
gl.GetGeoLocationByIP(ipAddress);
String country = gl.Country;
代码示例来源:origin: openimaj/openimaj
private static List<Query> geoLocQueries(List<Map<String, String>> geolocs) {
final List<Query> ret = new ArrayList<Query>();
for (final Map<String, String> geoloc : geolocs) {
final Query q = new Query();
q.geoCode(
new GeoLocation(
Double.parseDouble(geoloc.get("lat")),
Double.parseDouble(geoloc.get("lon"))
),
Double.parseDouble(geoloc.get("rad")),
Query.KILOMETERS
);
ret.add(q);
}
return ret;
}
}
代码示例来源:origin: org.openimaj/sandbox
private static List<Query> geoLocQueries(List<Map<String, String>> geolocs) {
final List<Query> ret = new ArrayList<Query>();
for (final Map<String, String> geoloc : geolocs) {
final Query q = new Query();
q.geoCode(
new GeoLocation(
Double.parseDouble(geoloc.get("lat")),
Double.parseDouble(geoloc.get("lon"))
),
Double.parseDouble(geoloc.get("rad")),
Query.KILOMETERS
);
ret.add(q);
}
return ret;
}
}
代码示例来源:origin: stackoverflow.com
SimpleQuery query = new SimpleQuery(conditions);
query.addProjectionOnField("*");
query.addProjectionOnField("distance:geodist(store," + GeoConverters.GeoLocationToStringConverter.INSTANCE.convert(new GeoLocation(45.15, -93.85)) + ")");
Page<EventDocument> result = template.queryForPage(query, EventDocument.class);
代码示例来源:origin: org.twitter4j/twitter4j-core
/**
* returns a GeoLocation instance if a "geo" element is found.
*
* @param json JSONObject to be parsed
* @return GeoLocation instance
* @throws TwitterException when coordinates is not included in geo element (should be an API side issue)
*/
/*package*/
static GeoLocation createGeoLocation(JSONObject json) throws TwitterException {
try {
if (!json.isNull("coordinates")) {
String coordinates = json.getJSONObject("coordinates")
.getString("coordinates");
coordinates = coordinates.substring(1, coordinates.length() - 1);
String[] point = coordinates.split(",");
return new GeoLocation(Double.parseDouble(point[1]),
Double.parseDouble(point[0]));
}
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
return null;
}
代码示例来源:origin: stackoverflow.com
this.latitude = latitude;
this.longitude = longitude;
this.place = new GeoLocation(latitude, longitude);
代码示例来源:origin: org.mule.modules/mule-module-twitter
/**
* Returns the locations that Twitter has trending topic information for, closest to a specified location.<br>
* The response is an array of "locations" that encode the location's WOEID and some other human-readable information such as a canonical name and country the location belongs in.<br>
* A WOEID is a <a href="http://developer.yahoo.com/geo/geoplanet/">Yahoo! Where On Earth ID</a>.
* <br>This method calls http://api.twitter.com/1.1/trends/closest.json
* <p/>
* {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:getClosestTrends}
*
* @param latitude The latitude of the location this tweet refers to. This parameter will be ignored unless it is
* inside the range -90.0 to +90.0 (North is positive) inclusive.
* @param longitude he longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to
* +180.0 (East is positive) inclusive. This parameter will be ignored if outside that range or if there not a
* corresponding lat parameter.
* @return the locations
* @throws TwitterException twitter4j.TwitterException when Twitter service or network is unavailable
*/
@Processor
public ResponseList<Location> getClosestTrends(double latitude, double longitude) throws TwitterException {
return getConnectionManagement().getTwitterClient().getClosestTrends(new GeoLocation(latitude, longitude));
}
代码示例来源:origin: stackoverflow.com
SimpleQuery query = new SimpleQuery(conditions);
query.addProjectionOnField("*");
query.addProjectionOnField("distance:geodist()");
DefaultQueryParser qp = new DefaultQueryParser();
final SolrQuery solrQuery = qp.constructSolrQuery(query);
solrQuery.add("sfield", "store");
solrQuery.add("pt", GeoConverters.GeoLocationToStringConverter.INSTANCE.convert(new GeoLocation(45.15, -93.85)));
solrQuery.add("d", GeoConverters.DistanceToStringConverter.INSTANCE.convert(new Distance(5)));
List<EventDocument> result = template.execute(new SolrCallback<List<EventDocument>>() {
@Override
public List<EventDocument> doInSolr(SolrServer solrServer) throws SolrServerException, IOException {
return template.getConverter().read(solrServer.query(solrQuery).getResults(), EventDocument.class);
}
});
代码示例来源:origin: stackoverflow.com
public static void reply(long inReplyToStatusId,String text,double latitude,double longitude,TwitterFactory factory) throws TwitterException
{ AccessToken accessToken = loadAccessToken();
Twitter twitter = factory.getInstance();
twitter.setOAuthConsumer(consumerKey, consumerSecrate);
twitter.setOAuthAccessToken(accessToken);
StatusUpdate stat= new StatusUpdate(text);
stat.setInReplyToStatusId(inReplyToStatusId);
GeoLocation location= new GeoLocation(latitude, longitude);
stat.setLocation(location);
twitter.updateStatus(stat);
}'
代码示例来源:origin: org.mule.modules/mule-module-twitter
/**
* Creates a new place at the given latitude and longitude.
* <p/>
* {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:createPlace}
*
* @param placeName The placeName a place is known as.
* @param containedWithin The place_id within which the new place can be found.
* Try and be as close as possible with the containing place. For
* example, for a room in a building, set the contained_within as the
* building place_id.
* @param token The token found in the response from geo/similar_places.
* @param latitude The latitude the place is located at.
* @param longitude The longitude the place is located at.
* @param streetAddress optional: This parameter searches for places which have
* this given street address. There are other well-known, and
* application specific attributes available. Custom attributes are
* also permitted. Learn more about Place Attributes.
* @return a new {@link Place}
* @throws TwitterException when Twitter service or network is unavailable
*/
@Processor
public Place createPlace(String placeName,
String containedWithin,
String token,
@Placement(group = "Coordinates") Double latitude,
@Placement(group = "Coordinates") Double longitude,
@Optional String streetAddress) throws TwitterException {
return getConnectionManagement().getTwitterClient().createPlace(placeName, containedWithin, token, new GeoLocation(latitude, longitude),
streetAddress);
}
代码示例来源:origin: org.twitter4j/twitter4j-core
static GeoLocation[][] coordinatesAsGeoLocationArray(JSONArray coordinates) throws TwitterException {
try {
GeoLocation[][] boundingBox = new GeoLocation[coordinates.length()][];
for (int i = 0; i < coordinates.length(); i++) {
JSONArray array = coordinates.getJSONArray(i);
boundingBox[i] = new GeoLocation[array.length()];
for (int j = 0; j < array.length(); j++) {
JSONArray coordinate = array.getJSONArray(j);
boundingBox[i][j] = new GeoLocation(coordinate.getDouble(1), coordinate.getDouble(0));
}
}
return boundingBox;
} catch (JSONException jsone) {
throw new TwitterException(jsone);
}
}
代码示例来源:origin: org.apache.camel/camel-twitter
&& ObjectHelper.isNotEmpty(endpoint.getProperties().getLongitude())
&& ObjectHelper.isNotEmpty(endpoint.getProperties().getRadius())) {
GeoLocation location = new GeoLocation(endpoint.getProperties().getLatitude(), endpoint.getProperties().getLongitude());
query.setGeoCode(location, endpoint.getProperties().getRadius(), Unit.valueOf(endpoint.getProperties().getDistanceMetric()));
代码示例来源:origin: org.mule.modules/mule-module-twitter
String placeName, @Optional String containedWithin,
@Optional String streetAddress) throws TwitterException {
return getConnectionManagement().getTwitterClient().getSimilarPlaces(new GeoLocation(latitude, longitude),
placeName, containedWithin, streetAddress);
内容来源于网络,如有侵权,请联系作者删除!