twitter4j.GeoLocation.getLongitude()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中twitter4j.GeoLocation.getLongitude()方法的一些代码示例,展示了GeoLocation.getLongitude()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GeoLocation.getLongitude()方法的具体详情如下:
包路径:twitter4j.GeoLocation
类名称:GeoLocation
方法名:getLongitude

GeoLocation.getLongitude介绍

[英]returns the longitude of the geo location
[中]返回地理位置的经度

代码示例

代码示例来源:origin: apache/incubator-druid

  1. if (null != geoLocation) {
  2. double lat = status.getGeoLocation().getLatitude();
  3. double lon = status.getGeoLocation().getLongitude();
  4. theMap.put("lat", lat);
  5. theMap.put("lon", lon);

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. /**
  2. * 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
  3. *
  4. * @param location geo location
  5. * @param radius radius
  6. * @param unit Use "mi" for miles or "km" for kilometers
  7. * @deprecated use {@link #setGeoCode(GeoLocation, double, twitter4j.Query.Unit)} instead
  8. */
  9. public void setGeoCode(GeoLocation location, double radius
  10. , String unit) {
  11. this.geocode = location.getLatitude() + "," + location.getLongitude() + "," + radius + unit;
  12. }

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. @Override
  2. public boolean equals(Object o) {
  3. if (this == o) return true;
  4. if (!(o instanceof GeoLocation)) return false;
  5. GeoLocation that = (GeoLocation) o;
  6. if (Double.compare(that.getLatitude(), latitude) != 0) return false;
  7. if (Double.compare(that.getLongitude(), longitude) != 0) return false;
  8. return true;
  9. }

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. /**
  2. * 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
  3. *
  4. * @param location geo location
  5. * @param radius radius
  6. * @param unit Query.MILES or Query.KILOMETERS
  7. * @since Twitter4J 4.0.1
  8. */
  9. public void setGeoCode(GeoLocation location, double radius
  10. , Unit unit) {
  11. this.geocode = location.getLatitude() + "," + location.getLongitude() + "," + radius + unit.name();
  12. }

代码示例来源:origin: stackoverflow.com

  1. GpsDirectory gpsDirectory = metadata.getDirectory(GpsDirectory.class);
  2. GeoLocation location = gpsDirectory.getGeoLocation();
  3. double lat = location.getLatitude();
  4. double lng = location.getLongitude();

代码示例来源:origin: P7h/StormTweetsSentimentAnalysis

  1. /**
  2. * Retrieves the State from GeoLocation Object of the Tweet.
  3. * This is considered as the primary and correct value for the State of the tweet.
  4. *
  5. * @param status -- Status Object.
  6. * @return State of tweet.
  7. */
  8. private final String getStateFromTweetGeoLocation(final Status status) {
  9. String state = null;
  10. final double latitude;
  11. final double longitude;
  12. final GeoLocation geoLocation = status.getGeoLocation();
  13. if (null != geoLocation) {
  14. latitude = geoLocation.getLatitude();
  15. longitude = geoLocation.getLongitude();
  16. LOGGER.debug("LatLng for BingMaps:{} and {}", latitude, longitude);
  17. final Optional<String> stateGeoOptional = BingMapsLookup.reverseGeocodeFromLatLong(latitude, longitude);
  18. if(stateGeoOptional.isPresent()){
  19. final String stateFromGeoLocation = stateGeoOptional.get();
  20. LOGGER.debug("State from BingMaps:{}", stateFromGeoLocation);
  21. state = (2 == stateFromGeoLocation.length())? stateFromGeoLocation.toUpperCase(): null;
  22. }
  23. }
  24. return state;
  25. }
  26. }

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. @Override
  2. public ResponseList<Place> getSimilarPlaces(GeoLocation location, String name, String containedWithin, String streetAddress) throws TwitterException {
  3. List<HttpParameter> params = new ArrayList<HttpParameter>(3);
  4. params.add(new HttpParameter("lat", location.getLatitude()));
  5. params.add(new HttpParameter("long", location.getLongitude()));
  6. params.add(new HttpParameter("name", name));
  7. if (containedWithin != null) {
  8. params.add(new HttpParameter("contained_within", containedWithin));
  9. }
  10. if (streetAddress != null) {
  11. params.add(new HttpParameter("attribute:street_address", streetAddress));
  12. }
  13. return factory.createPlaceList(get(conf.getRestBaseURL()
  14. + "geo/similar_places.json", params.toArray(new HttpParameter[params.size()])));
  15. }

代码示例来源:origin: jcustenborder/kafka-connect-twitter

  1. public static void convert(GeoLocation geoLocation, Struct struct) {
  2. if (null == geoLocation) {
  3. return;
  4. }
  5. struct.put("Latitude", geoLocation.getLatitude())
  6. .put("Longitude", geoLocation.getLongitude());
  7. }

代码示例来源:origin: stackoverflow.com

  1. return place.getLongitude();

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. /*package*/ HttpParameter[] asHttpParameterArray() {
  2. ArrayList<HttpParameter> params = new ArrayList<HttpParameter>();
  3. if (location != null) {
  4. appendParameter("lat", location.getLatitude(), params);
  5. appendParameter("long", location.getLongitude(), params);
  6. }
  7. if (ip != null) {
  8. appendParameter("ip", ip, params);
  9. }
  10. appendParameter("accuracy", accuracy, params);
  11. appendParameter("query", query, params);
  12. appendParameter("granularity", granularity, params);
  13. appendParameter("max_results", maxResults, params);
  14. HttpParameter[] paramArray = new HttpParameter[params.size()];
  15. return params.toArray(paramArray);
  16. }

代码示例来源:origin: FutureCitiesCatapult/TomboloDigitalConnector

  1. coordinate = new Coordinate(geoLocation.getLongitude(), geoLocation.getLatitude());

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. /*package*/ HttpParameter[] asHttpParameterArray() {
  2. ArrayList<HttpParameter> params = new ArrayList<HttpParameter>();
  3. appendParameter("status", status, params);
  4. if (-1 != inReplyToStatusId) {
  5. appendParameter("in_reply_to_status_id", inReplyToStatusId, params);
  6. }
  7. if (location != null) {
  8. appendParameter("lat", location.getLatitude(), params);
  9. appendParameter("long", location.getLongitude(), params);
  10. }
  11. appendParameter("place_id", placeId, params);
  12. if (!displayCoordinates) {
  13. appendParameter("display_coordinates", "false", params);
  14. }
  15. if (null != mediaFile) {
  16. params.add(new HttpParameter("media[]", mediaFile));
  17. params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
  18. } else if (mediaName != null && mediaBody != null) {
  19. params.add(new HttpParameter("media[]", mediaName, mediaBody));
  20. params.add(new HttpParameter("possibly_sensitive", possiblySensitive));
  21. } else if (mediaIds != null && mediaIds.length >= 1) {
  22. params.add(new HttpParameter("media_ids", StringUtil.join(mediaIds)));
  23. }
  24. if(autoPopulateReplyMetadata){
  25. appendParameter("auto_populate_reply_metadata", "true", params);
  26. }
  27. appendParameter("attachment_url", attachmentUrl, params);
  28. HttpParameter[] paramArray = new HttpParameter[params.size()];
  29. return params.toArray(paramArray);
  30. }

代码示例来源:origin: org.twitter4j/twitter4j-core

  1. @Override
  2. public ResponseList<Location> getClosestTrends(GeoLocation location) throws TwitterException {
  3. return factory.createLocationList(get(conf.getRestBaseURL()
  4. + "trends/closest.json",
  5. new HttpParameter("lat", location.getLatitude())
  6. , new HttpParameter("long", location.getLongitude())));
  7. }

代码示例来源:origin: io.druid.extensions/druid-examples

  1. if (null != geoLocation) {
  2. double lat = status.getGeoLocation().getLatitude();
  3. double lon = status.getGeoLocation().getLongitude();
  4. theMap.put("lat", lat);
  5. theMap.put("lon", lon);

代码示例来源:origin: rjyo/twitter-2-weibo

  1. tl.UpdateStatus(statusText, (float) location.getLatitude(), (float) location.getLongitude(), "");
  2. log.info(String.format("@%s - %s sent with geo locations.", name, statusText));
  3. } else {

代码示例来源:origin: lumongo/lumongo

  1. @Override
  2. public void onStatus(Status status) {
  3. Document tweet = new Document();
  4. tweet.put("_id", status.getId());
  5. tweet.put("createdAt", status.getCreatedAt());
  6. tweet.put("favoriteCount", status.getFavoriteCount());
  7. tweet.put("retweetCount", status.getRetweetCount());
  8. if (status.getGeoLocation() != null) {
  9. tweet.put("lat", status.getGeoLocation().getLatitude());
  10. tweet.put("long", status.getGeoLocation().getLongitude());
  11. }
  12. tweet.put("screenName", status.getUser().getScreenName());
  13. if (status.getRetweetedStatus() != null) {
  14. tweet.put("retweetedStatus", status.getRetweetedStatus().getText());
  15. }
  16. tweet.put("text", status.getText());
  17. Document query = new Document();
  18. query.put("_id", status.getId());
  19. collection.replaceOne(query, tweet, new UpdateOptions().upsert(true));
  20. }

代码示例来源:origin: openimaj/openimaj

  1. coords[1] = geloc.getLongitude();
  2. status.geo = coords;

代码示例来源:origin: org.openimaj/sandbox

  1. coords[1] = geloc.getLongitude();
  2. status.geo = coords;

相关文章