Package org.neo4j.gis.spatial

Examples of org.neo4j.gis.spatial.Layer


  @Test
  public void testQueryPerformance() {
    SpatialDatabaseService spatial = new SpatialDatabaseService(graphDb());
        try (Transaction tx = graphDb().beginTx()) {
            Layer layer = spatial.getLayer("GeoPipesPerformanceTest");
            // String[] keys = {"id","name","address","city","state","zip"};
            String[] keys = { "id", "name" };
            Coordinate loc = new Coordinate(15.0, 15.0);
            GeoPipeline flowList = ((GeoPipeline) GeoPipeline.startNearestNeighborLatLonSearch(layer, loc, records))
                    .copyDatabaseRecordProperties(keys);
View Full Code Here


  @Test
  public void testPagingPerformance() {
    SpatialDatabaseService spatial = new SpatialDatabaseService(graphDb());
        try (Transaction tx = graphDb().beginTx()) {
            Layer layer = spatial.getLayer("GeoPipesPerformanceTest");
            // String[] keys = {"id","name","address","city","state","zip"};
            String[] keys = { "id", "name" };
            Coordinate loc = new Coordinate(15.0, 15.0);
            ArrayList<TimeRecord> totals = new ArrayList<TimeRecord>();
            long prevTime = System.currentTimeMillis();
View Full Code Here

            List<String> notEmptyTypes = new ArrayList<String>();
            String[] allTypeNames = spatialDatabase.getLayerNames();
            for (int i = 0; i < allTypeNames.length; i++) {
                // discard empty layers
                System.out.print( "loading layer " + allTypeNames[i] );
                Layer layer = spatialDatabase.getLayer(allTypeNames[i]);
                if (!layer.getIndex().isEmpty()) {
                    notEmptyTypes.add(allTypeNames[i]);
                }
            }
            typeNames = notEmptyTypes.toArray(new String[] {});
        }
View Full Code Here

     * FeatureTypes are cached in memory.
     */
    public SimpleFeatureType getSchema(String typeName) throws IOException {
        SimpleFeatureType result = simpleFeatureTypeIndex.get(typeName);
        if (result == null) {
            Layer layer = spatialDatabase.getLayer(typeName);
            if (layer == null) {
                throw new IOException("Layer not found: " + typeName);
            }

            result = Neo4jFeatureBuilder.getTypeFromLayer(layer);
View Full Code Here

   
  /**
   * Create an optimized FeatureReader for most of the uDig operations.
   */
    protected FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(String typeName, Filter filter) throws IOException {
      Layer layer = spatialDatabase.getLayer(typeName);
     
      Iterator<SpatialDatabaseRecord> records;
      if (filter.equals(Filter.EXCLUDE)) {
        // filter that excludes everything: create an empty FeatureReader
      records = null;
    } else if (filter instanceof FidFilterImpl) {
      // filter by Feature unique id
      List<SpatialDatabaseRecord> results = layer.getIndex().get(convertToGeomNodeIds((FidFilterImpl) filter));
      System.out.println("found results for FidFilter: " + results.size());
      records = results.iterator();
    } else {
      records = layer.getIndex().search(new SearchCQL(layer, filter));
    }
     
    return new Neo4jSpatialFeatureReader(layer, getSchema(typeName), records);
    }
View Full Code Here

      System.out.println("getFeatureReader(" + typeName + ") SLOW QUERY :(");
    return getFeatureReader(typeName, new SearchAll());
  }
 
    private FeatureReader<SimpleFeatureType, SimpleFeature> getFeatureReader(String typeName, SearchFilter search) throws IOException {
      Layer layer = spatialDatabase.getLayer(typeName);   
      SearchRecords results = layer.getIndex().search(search);
      return new Neo4jSpatialFeatureReader(layer, getSchema(typeName), results);
    }
View Full Code Here

    }

    private CoordinateReferenceSystem getCRS(String typeName) {
      CoordinateReferenceSystem result = crsIndex.get(typeName);
        if (result == null) {
            Layer layer = spatialDatabase.getLayer(typeName);
            result = layer.getCoordinateReferenceSystem();
            crsIndex.put(typeName, result);
        }
     
      return result;
    }
View Full Code Here

    }

    public Style getStyle(String typeName) {
      Style result = styleIndex.get(typeName);
        if (true || result == null) {
            Layer layer = spatialDatabase.getLayer(typeName);
            Object obj = layer.getStyle();
            if(obj instanceof Style) {
              result = (Style)result;
            } else if (obj instanceof File || obj instanceof String) {
              StyleFactory styleFactory = new StyleFactoryImpl();
              SLDParser parser = new SLDParser(styleFactory);
View Full Code Here

     
      return result;
    }

    private Integer getGeometryType(String typeName) {
        Layer layer = spatialDatabase.getLayer(typeName);
        return layer.getGeometryType();
    }
View Full Code Here

        Layer layer = spatialDatabase.getLayer(typeName);
        return layer.getGeometryType();
    }

  private EditableLayer getEditableLayer(String typeName) throws IOException {
        Layer layer = spatialDatabase.getLayer(typeName);
        if (layer == null) {
            throw new IOException("Layer not found: " + typeName);
        }
       
        if (!(layer instanceof EditableLayer)) {
View Full Code Here

TOP

Related Classes of org.neo4j.gis.spatial.Layer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.