本文整理了Java中twitter4j.GeoLocation.getLongitude()
方法的一些代码示例,展示了GeoLocation.getLongitude()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoLocation.getLongitude()
方法的具体详情如下:
包路径:twitter4j.GeoLocation
类名称:GeoLocation
方法名:getLongitude
[英]returns the longitude of the geo location
[中]返回地理位置的经度
代码示例来源:origin: apache/incubator-druid
if (null != geoLocation) {
double lat = status.getGeoLocation().getLatitude();
double lon = status.getGeoLocation().getLongitude();
theMap.put("lat", lat);
theMap.put("lon", lon);
代码示例来源:origin: org.twitter4j/twitter4j-core
/**
* returns tweets by users located within a given radius of the given latitude/longitude, where the user's location is taken from their Twitter profile
*
* @param location geo location
* @param radius radius
* @param unit Use "mi" for miles or "km" for kilometers
* @deprecated use {@link #setGeoCode(GeoLocation, double, twitter4j.Query.Unit)} instead
*/
public void setGeoCode(GeoLocation location, double radius
, String unit) {
this.geocode = location.getLatitude() + "," + location.getLongitude() + "," + radius + unit;
}
代码示例来源:origin: org.twitter4j/twitter4j-core
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof GeoLocation)) return false;
GeoLocation that = (GeoLocation) o;
if (Double.compare(that.getLatitude(), latitude) != 0) return false;
if (Double.compare(that.getLongitude(), longitude) != 0) return false;
return true;
}
代码示例来源:origin: org.twitter4j/twitter4j-core
/**
* returns tweets by users located within a given radius of the given latitude/longitude, where the user's location is taken from their Twitter profile
*
* @param location geo location
* @param radius radius
* @param unit Query.MILES or Query.KILOMETERS
* @since Twitter4J 4.0.1
*/
public void setGeoCode(GeoLocation location, double radius
, Unit unit) {
this.geocode = location.getLatitude() + "," + location.getLongitude() + "," + radius + unit.name();
}
代码示例来源:origin: stackoverflow.com
GpsDirectory gpsDirectory = metadata.getDirectory(GpsDirectory.class);
GeoLocation location = gpsDirectory.getGeoLocation();
double lat = location.getLatitude();
double lng = location.getLongitude();
代码示例来源:origin: P7h/StormTweetsSentimentAnalysis
/**
* Retrieves the State from GeoLocation Object of the Tweet.
* This is considered as the primary and correct value for the State of the tweet.
*
* @param status -- Status Object.
* @return State of tweet.
*/
private final String getStateFromTweetGeoLocation(final Status status) {
String state = null;
final double latitude;
final double longitude;
final GeoLocation geoLocation = status.getGeoLocation();
if (null != geoLocation) {
latitude = geoLocation.getLatitude();
longitude = geoLocation.getLongitude();
LOGGER.debug("LatLng for BingMaps:{} and {}", latitude, longitude);
final Optional<String> stateGeoOptional = BingMapsLookup.reverseGeocodeFromLatLong(latitude, longitude);
if(stateGeoOptional.isPresent()){
final String stateFromGeoLocation = stateGeoOptional.get();
LOGGER.debug("State from BingMaps:{}", stateFromGeoLocation);
state = (2 == stateFromGeoLocation.length())? stateFromGeoLocation.toUpperCase(): null;
}
}
return state;
}
}
代码示例来源:origin: org.twitter4j/twitter4j-core
@Override
public ResponseList<Place> getSimilarPlaces(GeoLocation location, String name, String containedWithin, String streetAddress) throws TwitterException {
List<HttpParameter> params = new ArrayList<HttpParameter>(3);
params.add(new HttpParameter("lat", location.getLatitude()));
params.add(new HttpParameter("long", location.getLongitude()));
params.add(new HttpParameter("name", name));
if (containedWithin != null) {
params.add(new HttpParameter("contained_within", containedWithin));
}
if (streetAddress != null) {
params.add(new HttpParameter("attribute:street_address", streetAddress));
}
return factory.createPlaceList(get(conf.getRestBaseURL()
+ "geo/similar_places.json", params.toArray(new HttpParameter[params.size()])));
}
代码示例来源:origin: jcustenborder/kafka-connect-twitter
public static void convert(GeoLocation geoLocation, Struct struct) {
if (null == geoLocation) {
return;
}
struct.put("Latitude", geoLocation.getLatitude())
.put("Longitude", geoLocation.getLongitude());
}
代码示例来源:origin: stackoverflow.com
return place.getLongitude();
代码示例来源:origin: org.twitter4j/twitter4j-core
/*package*/ HttpParameter[] asHttpParameterArray() {
ArrayList<HttpParameter> params = new ArrayList<HttpParameter>();
if (location != null) {
appendParameter("lat", location.getLatitude(), params);
appendParameter("long", location.getLongitude(), params);
}
if (ip != null) {
appendParameter("ip", ip, params);
}
appendParameter("accuracy", accuracy, params);
appendParameter("query", query, params);
appendParameter("granularity", granularity, params);
appendParameter("max_results", maxResults, params);
HttpParameter[] paramArray = new HttpParameter[params.size()];
return params.toArray(paramArray);
}
代码示例来源:origin: FutureCitiesCatapult/TomboloDigitalConnector
coordinate = new Coordinate(geoLocation.getLongitude(), geoLocation.getLatitude());
代码示例来源:origin: org.twitter4j/twitter4j-core
/*package*/ HttpParameter[] asHttpParameterArray() {
ArrayList<HttpParameter> params = new ArrayList<HttpParameter>();
appendParameter("status", status, params);
if (-1 != inReplyToStatusId) {
appendParameter("in_reply_to_status_id", inReplyToStatusId, params);
}
if (location != null) {
appendParameter("lat", location.getLatitude(), params);
appendParameter("long", location.getLongitude(), params);
}
appendParameter("place_id", placeId, params);
if (!displayCoordinates) {
appendParameter("display_coordinates", "false", params);
}
if (null != mediaFile) {
params.add(new HttpParameter("media[]", mediaFile));
params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
} else if (mediaName != null && mediaBody != null) {
params.add(new HttpParameter("media[]", mediaName, mediaBody));
params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
} else if (mediaIds != null && mediaIds.length >= 1) {
params.add(new HttpParameter("media_ids", StringUtil.join(mediaIds)));
}
if(autoPopulateReplyMetadata){
appendParameter("auto_populate_reply_metadata", "true", params);
}
appendParameter("attachment_url", attachmentUrl, params);
HttpParameter[] paramArray = new HttpParameter[params.size()];
return params.toArray(paramArray);
}
代码示例来源:origin: org.twitter4j/twitter4j-core
@Override
public ResponseList<Location> getClosestTrends(GeoLocation location) throws TwitterException {
return factory.createLocationList(get(conf.getRestBaseURL()
+ "trends/closest.json",
new HttpParameter("lat", location.getLatitude())
, new HttpParameter("long", location.getLongitude())));
}
代码示例来源:origin: io.druid.extensions/druid-examples
if (null != geoLocation) {
double lat = status.getGeoLocation().getLatitude();
double lon = status.getGeoLocation().getLongitude();
theMap.put("lat", lat);
theMap.put("lon", lon);
代码示例来源:origin: rjyo/twitter-2-weibo
tl.UpdateStatus(statusText, (float) location.getLatitude(), (float) location.getLongitude(), "");
log.info(String.format("@%s - %s sent with geo locations.", name, statusText));
} else {
代码示例来源:origin: lumongo/lumongo
@Override
public void onStatus(Status status) {
Document tweet = new Document();
tweet.put("_id", status.getId());
tweet.put("createdAt", status.getCreatedAt());
tweet.put("favoriteCount", status.getFavoriteCount());
tweet.put("retweetCount", status.getRetweetCount());
if (status.getGeoLocation() != null) {
tweet.put("lat", status.getGeoLocation().getLatitude());
tweet.put("long", status.getGeoLocation().getLongitude());
}
tweet.put("screenName", status.getUser().getScreenName());
if (status.getRetweetedStatus() != null) {
tweet.put("retweetedStatus", status.getRetweetedStatus().getText());
}
tweet.put("text", status.getText());
Document query = new Document();
query.put("_id", status.getId());
collection.replaceOne(query, tweet, new UpdateOptions().upsert(true));
}
代码示例来源:origin: openimaj/openimaj
coords[1] = geloc.getLongitude();
status.geo = coords;
代码示例来源:origin: org.openimaj/sandbox
coords[1] = geloc.getLongitude();
status.geo = coords;
内容来源于网络,如有侵权,请联系作者删除!