Tabnine Logo
org.geojson
Code IndexAdd Tabnine to your IDE (free)

How to use org.geojson

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

origin: opentripplanner/OpenTripPlanner

  private static Coordinate[] convertPath(List<LngLatAlt> path) {
    Coordinate[] coords = new Coordinate[path.size()];
    int i = 0;
    for (LngLatAlt p : path) {
      coords[i++] = new Coordinate(p.getLatitude(), p.getLongitude());
    }
    return coords;
  }
}
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()));
  LinearRing shell = gf.createLinearRing(convertPath(geoJsonPolygon.getExteriorRing()));
  LinearRing[] holes = new LinearRing[geoJsonPolygon.getInteriorRings().size()];
  int i = 0;
  for (List<LngLatAlt> hole : geoJsonPolygon.getInteriorRings()) {
    holes[i++] = gf.createLinearRing(convertPath(hole));
  Polygon[] jtsPolygons = new Polygon[geoJsonMultiPolygon.getCoordinates().size()];
  int i = 0;
  for (List<List<LngLatAlt>> geoJsonRings : geoJsonMultiPolygon.getCoordinates()) {
    org.geojson.Polygon geoJsonPoly = new org.geojson.Polygon();
    for (List<LngLatAlt> geoJsonRing : geoJsonRings)
      geoJsonPoly.add(geoJsonRing);
    jtsPolygons[i++] = (Polygon) convertGeoJsonToJtsGeometry(geoJsonPoly);
  return gf.createLineString(convertPath(geoJsonLineString.getCoordinates()));
  LineString[] jtsLineStrings = new LineString[geoJsonMultiLineString.getCoordinates().size()];
  int i = 0;
  for (List<LngLatAlt> geoJsonPath : geoJsonMultiLineString.getCoordinates()) {
    org.geojson.LineString geoJsonLineString = new org.geojson.LineString(
        geoJsonPath.toArray(new LngLatAlt[geoJsonPath.size()]));
    jtsLineStrings[i++] = (LineString) convertGeoJsonToJtsGeometry(geoJsonLineString);
origin: opentripplanner/OpenTripPlanner

  org.geojson.Polygon p = new org.geojson.Polygon();
  List<LngLatAlt> shell = new ArrayList<LngLatAlt>();
  for (Coordinate c : polygons[i].getExteriorRing().getCoordinates()) {
    shell.add(new LngLatAlt(c.x, c.y));
  p.add(shell);
  geomSerializer.writeValue(jgen, p);
} else {
  org.geojson.Point p = new org.geojson.Point(lons[i], lats[i]);
  geomSerializer.writeValue(jgen, p);
origin: opentripplanner/OpenTripPlanner

for (Feature feature : featureCollection.getFeatures()) {
  GeoJsonObject geom = feature.getGeometry();
  if (geom instanceof Point) {
    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

@SuppressWarnings("unchecked")
public static PointFeature fromJsonNode(JsonNode feature) throws EmptyPolygonException,
    UnsupportedGeometryException {
  Feature geoJsonFeature;
  try {
    geoJsonFeature = deserializer.readValue(feature.traverse(), Feature.class);
  } catch (IOException e) {
    throw new UnsupportedGeometryException(e.getMessage());
  }
  PointFeature ret = new PointFeature(geoJsonFeature.getId());
  ret.setGeom(GeometryUtils.convertGeoJsonToJtsGeometry(geoJsonFeature.getGeometry()));
  Object structured = geoJsonFeature.getProperty("structured");
  if (structured == null || !(structured instanceof Map))
    return null;
  // The code below assume the structured map to have integers only
  ret.setAttributes((Map<String, Integer>)(structured));
  return ret;
}
origin: org.schoellerfamily.gedbrowser/geoservice-persistence

/**
 * Build a bounding box feature.
 * In this case, it has a name but is empty.
 *
 * @param id the ID string
 * @return the Feature for the new bounds
 */
public static Feature createBounds(final String id) {
  final Feature feature = new Feature();
  feature.setId(id);
  feature.setGeometry(new Polygon());
  return feature;
}
origin: cyclestreets/android

 @SuppressWarnings("unchecked")
 protected static <V> V propertyOrDefault(Feature feature, String propertyName, V defaultValue) {
  return (feature.getProperty(propertyName) == null) ? defaultValue : (V)feature.getProperty(propertyName);
 }
}
origin: de.grundid.opendatalab/geojson-jackson

@Override
public int hashCode() {
  int result = super.hashCode();
  result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
  return result;
}
origin: de.grundid.opendatalab/geojson-jackson

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (!(o instanceof Point)) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  Point point = (Point)o;
  return !(coordinates != null ? !coordinates.equals(point.coordinates) : point.coordinates != null);
}
origin: de.grundid.opendatalab/geojson-jackson

  @Override
  public String toString() {
    return "Geometry{" + "coordinates=" + coordinates + "} " + super.toString();
  }
}
origin: opendatalab-de/geojson-jackson

  @Override
  public String toString() {
    return "MultiLineString{} " + super.toString();
  }
}
origin: org.schoellerfamily.gedbrowser/geoservice-persistence

/**
 * Default constructor to use in serialization.
 */
public GeoServiceGeometry() {
  this.featureCollection = new FeatureCollection();
}
origin: de.grundid.opendatalab/geojson-jackson

  @Override
  public String toString() {
    return "LineString{} " + super.toString();
  }
}
origin: opendatalab-de/geojson-jackson

@Override
public int hashCode() {
  int result = super.hashCode();
  result = 31 * result + (coordinates != null ? coordinates.hashCode() : 0);
  return result;
}
origin: opendatalab-de/geojson-jackson

@Override
public boolean equals(Object o) {
  if (this == o) {
    return true;
  }
  if (!(o instanceof Point)) {
    return false;
  }
  if (!super.equals(o)) {
    return false;
  }
  Point point = (Point)o;
  return !(coordinates != null ? !coordinates.equals(point.coordinates) : point.coordinates != null);
}
origin: de.grundid.opendatalab/geojson-jackson

  @Override
  public String toString() {
    return "GeometryCollection{" + "geometries=" + geometries + "} " + super.toString();
  }
}
origin: de.grundid.opendatalab/geojson-jackson

  @Override
  public String toString() {
    return "MultiPolygon{} " + super.toString();
  }
}
origin: org.schoellerfamily.gedbrowser/geoservice-persistence

/**
 * Default constructor used in serialization.
 */
public GeoServiceGeocodingResult() {
  this.addressComponents = new AddressComponent[0];
  this.types = new AddressType[0];
  this.geometry = new FeatureCollection();
}
origin: opendatalab-de/geojson-jackson

  @Override
  public String toString() {
    return "GeometryCollection{" + "geometries=" + geometries + "} " + super.toString();
  }
}
origin: opendatalab-de/geojson-jackson

  @Override
  public String toString() {
    return "MultiPolygon{} " + super.toString();
  }
}
org.geojson

Most used classes

  • LngLatAlt
  • Point
  • Feature
  • Polygon
  • FeatureCollection
  • LineString,
  • MultiLineString,
  • MultiPoint,
  • Crs,
  • CrsType,
  • GeoJsonObject,
  • GeoJsonObjectVisitor,
  • Geometry,
  • LngLatAltDeserializer
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