Examples of FeatureCollection


Examples of com.simplegeo.client.types.FeatureCollection

  @Test
  public void testSearchByMyIPSync() {
    try {
      String jsonString = client.searchByMyIP("casey.testing.layer", null);
      FeatureCollection featureCollection = FeatureCollection.fromJSONString(jsonString);
     
      Assert.assertNotNull(featureCollection.getFeatures());
    } catch (IOException e) {
      Assert.fail(e.getMessage());     
    } catch (JSONException e) {
      Assert.fail(e.getMessage());     
    }
View Full Code Here

Examples of com.vividsolutions.jump.feature.FeatureCollection

          gg.setBoundingBox(env);
          geomList.add(gg.create());
        }
      }
     
      FeatureCollection fc = FeatureDatasetFactory.createFromGeometry(geomList);
     
      IOUtil.saveShapefile(fc,args[1]+"_"+i+".shp");
    }
  }
View Full Code Here

Examples of com.vividsolutions.jump.feature.FeatureCollection

        gg.setBoundingBox(env);
        geomList.add(gg.create());
      }
    }
   
    FeatureCollection fc = FeatureDatasetFactory.createFromGeometry(geomList);
   
    IOUtil.saveShapefile(fc,args[2]);
  }
View Full Code Here

Examples of org.geojson.FeatureCollection

 
  /**Load shape from the given file.
   * Contents of the file are assumed to be GeoJSON.**/
  public static Shape loadShapeJSON(File source) {
    try (FileInputStream fs = new FileInputStream(source)){
      FeatureCollection fc = new ObjectMapper().readValue(fs, FeatureCollection.class);
      Feature feature = fc.getFeatures().get(0);
      @SuppressWarnings("rawtypes")

      Geometry geometry = (Geometry) feature.getGeometry();
      if (geometry instanceof MultiPolygon) {
        return toArea((MultiPolygon) geometry);
View Full Code Here

Examples of org.geoscript.js.feature.FeatureCollection

        } else if (value instanceof SimpleFeature) {
            value = new Feature(scope, (SimpleFeature) value);
        } else if (value instanceof SimpleFeatureType) {
            value = new Schema(scope, (SimpleFeatureType) value);
        } else if (value instanceof SimpleFeatureCollection) {
            value = new FeatureCollection(scope, (SimpleFeatureCollection) value);
        }
        return Context.javaToJS(value, scope);
    }
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

            // Construct a envelope from the transformed coordinate
            Envelope env = new Envelope(new Coordinate(to[0],to[1]));

            // Query the feature source to get the features that intersect with that coordinate
            FeatureSource source = layer.getResource(FeatureSource.class, ProgressManager.instance().get());
            FeatureCollection features = source.getFeatures(layer.createBBoxFilter(env, ProgressManager.instance().get()));
           
            // do something with the features...
           
        }catch( Throwable t ){
            // do something smart, notify user probably.
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

                }
               
                LOGGER.fine("Query is " + query + "\n To gt2: " + query.toDataQuery(Integer.MAX_VALUE));

                //DJB: note if maxFeatures gets to 0 the while loop above takes care of this! (this is a subtle situation)
                FeatureCollection featuresCheck = source.getFeatures(query.toDataQuery(Integer.MAX_VALUE));
               
                // find nearest feature
                Unit fromUnit = SI.METER;
                Unit toUnit = UnitFormat.getInstance().parseUnit(request.getUnits());
                Converter unitConvert = fromUnit.getConverterTo(toUnit);
                Feature nearestFeature = null;
                double nearestDistance = 9e9;
                double nearestBearing = 0;
                for (Iterator sItr = featuresCheck.iterator(); sItr.hasNext();) {
                    Feature f = (Feature)sItr.next();
                    if (f.getDefaultGeometry() == null) continue;
                    DistanceOp op = new DistanceOp(request.getPoint(), f.getDefaultGeometry());
                    Coordinate[] co = op.closestPoints();
                    Measure m = DefaultGeographicCRS.WGS84.distance(new double[] { co[0].x, co[0].y, }, new double[] { co[1].x, co[1].y, });
                    if (m.doubleValue() > nearestDistance) continue;
                    nearestFeature = f;
                    nearestDistance = m.doubleValue();
                    nearestBearing = calcBearing(co);
                }

                //GR: I don't know if the featuresults should be added here for later
                //encoding if it was a lock request. may be after ensuring the lock
                //succeed?
                FeatureCollection features = FeatureCollections.newCollection();
                if (nearestFeature != null) features.add(superFeature(nearestFeature, unitConvert.convert(nearestDistance), nearestBearing));
               
                // we may need to shave off geometries we did load only to make bounds
                // computation happy
                if(extraGeometries.size() > 0) {
                    List residualProperties = new ArrayList(properties);
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

                    remoteStatesAvailable = Boolean.TRUE;
                    // check a basic response can be answered correctly
                    DefaultQuery dq = new DefaultQuery(TOPP_STATES);
                    FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);
                    dq.setFilter(ff.greater(ff.property("PERSONS"), ff.literal(20000000)));
                    FeatureCollection fc = fs.getFeatures(dq);
                    if(fc.size() != 1) {
                        logger.log(Level.WARNING, "Remote database status invalid, there should be one and only one " +
                                "feature with more than 20M persons in topp:states");
                        remoteStatesAvailable = Boolean.FALSE;
                    }
                   
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        assertEquals("application/zip", ogr.getMimeType(null, op));
    }

    public void testSimpleKML() throws Exception {
        // prepare input
        FeatureCollection fc = dataStore.getFeatureSource("Buildings").getFeatures();
        fct.getFeature().add(fc);

        // write out
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        gft.setOutputFormat("OGR-KML");
View Full Code Here

Examples of org.geotools.feature.FeatureCollection

        assertEquals(2, dom.getElementsByTagName("Placemark").getLength());
    }
   
    public void testSimpleCSV() throws Exception {
        // prepare input
        FeatureCollection fc = dataStore.getFeatureSource("Buildings").getFeatures();
        fct.getFeature().add(fc);

        // write out
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        gft.setOutputFormat("OGR-CSV");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.