Tabnine Logo
Point.getCoordinates
Code IndexAdd Tabnine to your IDE (free)

How to use
getCoordinates
method
in
org.geojson.Point

Best Java code snippets using org.geojson.Point.getCoordinates (Showing top 12 results out of 315)

origin: opentripplanner/OpenTripPlanner

Point p = (Point) geom;
GeocoderResult res = new GeocoderResult();
res.setLat(p.getCoordinates().getLatitude());
res.setLng(p.getCoordinates().getLongitude());
res.setDescription(feature.getProperties().get("label").toString());
origin: opentripplanner/OpenTripPlanner

if (geoJsonGeom instanceof org.geojson.Point) {
  org.geojson.Point geoJsonPoint = (org.geojson.Point) geoJsonGeom;
  return gf.createPoint(new Coordinate(geoJsonPoint.getCoordinates().getLongitude(), geoJsonPoint
      .getCoordinates().getLatitude()));
origin: org.schoellerfamily.gedbrowser/geoservice-persistence

  /**
   * Create a LatLng from a GeoJSON Point.
   *
   * @param point the Point
   * @return the LatLng
   */
  default LatLng toLatLng(final Point point) {
    if (point == null) {
      return null;
    }
    return toLatLng(point.getCoordinates());
  }
}
origin: cpesch/RouteConverter

private List<NavigationPosition> extractPositions(List<Feature> features) {
  List<NavigationPosition> result = new ArrayList<>(features.size());
  for (Feature feature : features) {
    GeoJsonObject geometry = feature.getGeometry();
    if (!(geometry instanceof Point))
      continue;
    Point point = (Point) geometry;
    LngLatAlt lngLatAlt = point.getCoordinates();
    String type = feature.getProperty("osm_key");
    result.add(new SimpleNavigationPosition(lngLatAlt.getLongitude(), lngLatAlt.getLatitude(), null,
        getDisplayName(feature) + " (" + type + ")"));
  }
  return result;
}
origin: dstl/baleen

private Optional<? extends LatLon> createPoiFromGeoJson(final GeoJsonObject object) {
 if (object instanceof Point) {
  final Point p = (Point) object;
  return toGeoLocation(p.getCoordinates());
 } else if (object instanceof Polygon) {
  final Polygon p = (Polygon) object;
  return toGeoLocation(p.getExteriorRing(), true);
 } else if (object instanceof LineString) {
  return toGeoLocation(((LineString) object).getCoordinates(), false);
 } else if (object instanceof MultiPolygon) {
  return toGeoLocation((MultiPolygon) object);
 } else if (object instanceof MultiPoint) {
  return ((MultiPoint) object)
    .getCoordinates()
    .stream()
    .map(this::toGeoLocation)
    .filter(Optional::isPresent)
    .map(Optional::get)
    .findFirst();
 } else {
  // TODO: Could implement others here but Baleen currently only outputs the above ..
 }
 return Optional.empty();
}
origin: cyclestreets/android

private static POI toPoi(Feature feature) {
 LngLatAlt coordinates = ((Point)feature.getGeometry()).getCoordinates();
 Map<String, String> osmTags = feature.getProperty("osmTags");
 if (osmTags == null)
  osmTags = new HashMap<>();
 String openingHours = osmTags.get("opening_hours");
 if (openingHours != null)
  openingHours = openingHours.replaceAll("; *", "\n");
 String website = feature.getProperty("website");
 if (TextUtils.isEmpty(website))
  website = osmTags.get("url");
 return new POI(Integer.parseInt(feature.getProperty("id")),
         feature.getProperty("name"),
         feature.getProperty("notes"),
         website,
         osmTags.get("phone"),
         openingHours,
         coordinates.getLatitude(),
         coordinates.getLongitude());
}
origin: streampipes/streampipes-ce

private List<EventProperty> parseGeometryField(Feature geoFeature) {
  List<EventProperty> eventProperties = new LinkedList<>();
  if(geoFeature.getGeometry() instanceof Point) {
    Point point = (Point) geoFeature.getGeometry();
    eventProperties.add(getEventPropertyGeoJson("longitude", point.getCoordinates().getLongitude(), SO.Longitude));
    eventProperties.add(getEventPropertyGeoJson("latitude", point.getCoordinates().getLatitude(), SO.Latitude));
    if (point.getCoordinates().hasAltitude()) {
      eventProperties.add(getEventPropertyGeoJson("altitude", point.getCoordinates().getAltitude(), SO.Altitude));
    }
  } else if (geoFeature.getGeometry() instanceof LineString) {
    LineString lineString = (LineString) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesLineString", lineString.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof Polygon) {
    Polygon polygon = (Polygon) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesPolygon", polygon.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof MultiPoint) {
    MultiPoint multiPoint = (MultiPoint) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesMultiPoint", multiPoint.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof MultiLineString) {
    MultiLineString multiLineString = (MultiLineString) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesMultiLineString", multiLineString.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof MultiPolygon) {
    MultiPolygon multiPolygon = (MultiPolygon) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesMultiPolygon", multiPolygon.getCoordinates()));
  } else {
    logger.error("No geometry field found in geofeature: " + geoFeature.toString());
  }
  return eventProperties;
}
origin: org.schoellerfamily.gedbrowser/gedbrowser-renderer

final Feature locationFeature = features.get(0);
final Point locationPoint = (Point) locationFeature.getGeometry();
final LngLatAlt location = locationPoint.getCoordinates();
if (features.size() > 2) {
  final Feature viewportFeature = features.get(2);
origin: org.streampipes/streampipes-connect

private List<EventProperty> parseGeometryField(Feature geoFeature) {
  List<EventProperty> eventProperties = new LinkedList<>();
  if(geoFeature.getGeometry() instanceof Point) {
    Point point = (Point) geoFeature.getGeometry();
    eventProperties.add(getEventPropertyGeoJson("longitude", point.getCoordinates().getLongitude(), SO.Longitude));
    eventProperties.add(getEventPropertyGeoJson("latitude", point.getCoordinates().getLatitude(), SO.Latitude));
    if (point.getCoordinates().hasAltitude()) {
      eventProperties.add(getEventPropertyGeoJson("altitude", point.getCoordinates().getAltitude(), SO.Altitude));
    }
  } else if (geoFeature.getGeometry() instanceof LineString) {
    LineString lineString = (LineString) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesLineString", lineString.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof Polygon) {
    Polygon polygon = (Polygon) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesPolygon", polygon.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof MultiPoint) {
    MultiPoint multiPoint = (MultiPoint) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesMultiPoint", multiPoint.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof MultiLineString) {
    MultiLineString multiLineString = (MultiLineString) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesMultiLineString", multiLineString.getCoordinates()));
  } else if (geoFeature.getGeometry() instanceof MultiPolygon) {
    MultiPolygon multiPolygon = (MultiPolygon) geoFeature.getGeometry();
    eventProperties.add(JsonEventProperty.getEventProperty("coorindatesMultiPolygon", multiPolygon.getCoordinates()));
  } else {
    logger.error("No geometry field found in geofeature: " + geoFeature.toString());
  }
  return eventProperties;
}
origin: cyclestreets/android

 private static GeoPlace toGeoPlace(Feature feature) {
  LngLatAlt coordinates = ((Point)feature.getGeometry()).getCoordinates();
  return new GeoPlace(new GeoPoint(coordinates.getLatitude(), coordinates.getLongitude()),
            (String)feature.getProperty("name"),
            (String)feature.getProperty("near"));
 }
}
origin: cyclestreets/android

private static Photo toPhoto(Feature feature) {
 LngLatAlt coordinates = ((Point)feature.getGeometry()).getCoordinates();
 GeoPoint geoPoint = new GeoPoint(coordinates.getLatitude(), coordinates.getLongitude());
 return new Photo(propertyOrDefault(feature, "id", -1),
          propertyOrDefault(feature, "categoryId", "Not known"),
          propertyOrDefault(feature, "metacategoryId", "Not known"),
          (String)feature.getProperty("caption"),
          (String)feature.getProperty("shortlink"),
          (String)feature.getProperty("thumbnailUrl"),
          geoPoint,
          toVideos(propertyOrDefault(feature, "videoFormats", Collections.<String, Object>emptyMap())));
}
origin: opendatakit/briefcase

@Test
public void writes_the_GeoJSON_file() throws IOException {
 List<Feature> outputFeatures = IntStream.range(0, 1000).mapToObj(i -> buildFeature()).collect(Collectors.toList());
 GeoJson.write(output, outputFeatures.stream());
 FeatureCollection parsedFeatureCollection = new ObjectMapper().readValue(Files.newInputStream(output), FeatureCollection.class);
 List<Feature> actualFeatures = parsedFeatureCollection.getFeatures();
 assertThat(actualFeatures, hasSize(1000));
 assertThat(actualFeatures, allMatch(feature -> feature.getGeometry() instanceof Point));
 assertThat(actualFeatures, allMatch(feature -> ((Point) feature.getGeometry()).getCoordinates() != null));
 assertThat(actualFeatures, allMatch(feature -> feature.getProperties().containsKey("key") && feature.getProperty("key") != null));
 assertThat(actualFeatures, allMatch(feature -> feature.getProperties().containsKey("field") && feature.getProperty("field").equals("some-field")));
 assertThat(actualFeatures, allMatch(feature -> feature.getProperties().containsKey("empty") && feature.getProperty("empty").equals("no")));
 assertThat(actualFeatures, allMatch(feature -> feature.getProperties().containsKey("valid") && feature.getProperty("valid").equals("yes")));
}
org.geojsonPointgetCoordinates

Popular methods of Point

  • <init>
  • setCrs

Popular in Java

  • Start an intent from android
  • setScale (BigDecimal)
  • scheduleAtFixedRate (Timer)
  • putExtra (Intent)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Stack (java.util)
    Stack is a Last-In/First-Out(LIFO) data structure which represents a stack of objects. It enables u
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • JFileChooser (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now