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

How to use
Point
in
org.geojson

Best Java code snippets using org.geojson.Point (Showing top 18 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

  geomSerializer.writeValue(jgen, p);
} else {
  org.geojson.Point p = new org.geojson.Point(lons[i], lats[i]);
  geomSerializer.writeValue(jgen, p);
origin: sinergise/Sentinel2ProductIngestor

public static org.geojson.Point toGeoJson(Point jtsPoint) {
  if (jtsPoint == null)
    return null;
  org.geojson.Point geoJsonPoint = new org.geojson.Point(new LngLatAlt(jtsPoint.getX(), jtsPoint.getY()));
  geoJsonPoint.setCrs(createCrsForEpsgCode(jtsPoint.getSRID()));
  return geoJsonPoint;
}
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 GeoJSON Point from a LatLng.
   *
   * @param latLng the LatLng
   * @return the GeoServiceLatLng
   */
  default Point toPoint(final LatLng latLng) {
    if (latLng == null) {
      return null;
    }
    return new Point(latLng.lng, latLng.lat);
  }
}
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: opendatakit/briefcase

 private Feature buildFeature() {
  Feature feature = new Feature();
  feature.setGeometry(new Point(Math.random() * 360 - 180, Math.random() * 180 - 90));
  feature.setProperty("key", instanceIdSeq.getAndIncrement());
  feature.setProperty("field", "some-field");
  feature.setProperty("empty", "no");
  feature.setProperty("valid", "yes");
  return feature;
 }
}
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: org.schoellerfamily.gedbrowser/geoservice-persistence

  /**
   * Create a GeoJSON Point from a LatLng.
   *
   * @param latLng the LatLng
   * @param locationType the location type
   * @return the GeoServiceLatLng
   */
  default Feature toLocationFeature(final LatLng latLng,
      final LocationType locationType) {
    if (latLng == null) {
      final Feature feature = new Feature();
      feature.setProperty("locationType", locationType);
      feature.setId("location");
      return feature;
    }
    final Point point = new Point(latLng.lng, latLng.lat);
    final Feature feature = new Feature();
    feature.setGeometry(point);
    feature.setProperty("locationType", locationType);
    feature.setId("location");
    return feature;
  }
}
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: opendatakit/briefcase

@Test
public void transforms_a_submission_to_a_feature_list() throws IOException, XmlPullParserException {
 Map<String, Feature> features = getFeatures(
   Pair.of(GEOPOINT, "1 2 3"),
   Pair.of(GEOTRACE, "1 2;3 4"),
   Pair.of(GEOSHAPE, "1 2;3 4;5 6;1 2")
 ).stream().collect(toMap(
   f -> f.getProperty("field"),
   f -> f
 ));
 assertThat(features.values(), hasSize(3));
 assertThat(features.values(), allMatch(feature -> feature.getProperty("key").equals("uuid:39f3dd36-161e-45cb-a1a4-395831d253a7")));
 assertThat(features.values(), allMatch(feature -> feature.getProperty("empty").equals("no")));
 assertThat(features.get("some-field-1").getGeometry(), is(new Point(2, 1, 3)));
 assertThat(features.get("some-field-2").getGeometry(), is(new LineString(new LngLatAlt(2, 1), new LngLatAlt(4, 3))));
 assertThat(features.get("some-field-3").getGeometry(), is(new Polygon(new LngLatAlt(2, 1), new LngLatAlt(4, 3), new LngLatAlt(6, 5), new LngLatAlt(2, 1))));
}
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.geojsonPoint

Most used methods

  • getCoordinates
  • <init>
  • setCrs

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • JButton (javax.swing)
  • JOptionPane (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • 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