Java Code Examples for com.thinkaurelius.titan.core.attribute.Geoshape#Point
The following examples show how to use
com.thinkaurelius.titan.core.attribute.Geoshape#Point .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Solr5Index.java From incubator-atlas with Apache License 2.0 | 6 votes |
private List<Geoshape.Point> getPolygonPoints(Geoshape polygon) { List<Geoshape.Point> locations = new ArrayList<>(); int index = 0; boolean hasCoordinates = true; while (hasCoordinates) { try { locations.add(polygon.getPoint(index)); } catch (ArrayIndexOutOfBoundsException ignore) { //just means we asked for a point past the size of the list //of known coordinates hasCoordinates = false; } } return locations; }
Example 2
Source File: GeoToWktConverter.java From titan1withtp3.1 with Apache License 2.0 | 5 votes |
/** * {@link com.thinkaurelius.titan.core.attribute.Geoshape} stores Points in the String format: point[X.0,Y.0]. * Solr needs it to be in Well-Known Text format: POINT(X.0 Y.0) */ public static String convertToWktString(Geoshape fieldValue) throws BackendException { if (fieldValue.getType() == Geoshape.Type.POINT) { Geoshape.Point point = fieldValue.getPoint(); return "POINT(" + point.getLongitude() + " " + point.getLatitude() + ")"; } else { throw new PermanentBackendException("Cannot index " + fieldValue.getType()); } }
Example 3
Source File: Solr5Index.java From incubator-atlas with Apache License 2.0 | 5 votes |
/** * {@link com.thinkaurelius.titan.core.attribute.Geoshape} stores Points in the String format: point[X.0,Y.0]. * Solr needs it to be in Well-Known Text format: POINT(X.0 Y.0) */ static String convertToWktString(Geoshape fieldValue) throws BackendException { if (fieldValue.getType() == Geoshape.Type.POINT) { Geoshape.Point point = fieldValue.getPoint(); return "POINT(" + point.getLongitude() + " " + point.getLatitude() + ")"; } else { throw new PermanentBackendException("Cannot index " + fieldValue.getType()); } }