当前位置: 首页>>代码示例>>Java>>正文


Java FilterFactory2.and方法代码示例

本文整理汇总了Java中org.opengis.filter.FilterFactory2.and方法的典型用法代码示例。如果您正苦于以下问题:Java FilterFactory2.and方法的具体用法?Java FilterFactory2.and怎么用?Java FilterFactory2.and使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opengis.filter.FilterFactory2的用法示例。


在下文中一共展示了FilterFactory2.and方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: logical

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
public void logical() {
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();
    Filter filter;
    // logical start

    // you can use *not* to invert the test; this is especially handy
    // with like filters (allowing you to select content that does not
    // match the provided pattern)
    filter = ff.not(ff.like(ff.property("code"), "230%"));

    // you can also combine filters to narrow the results returned
    filter = ff.and(ff.greater(ff.property("rainfall"), ff.literal(70)),
            ff.equal(ff.property("land_use"), ff.literal("urban"), false));

    filter = ff.or(ff.equal(ff.property("code"), ff.literal("approved")),
            ff.greater(ff.property("funding"), ff.literal(23000)));

    // logical end
}
 
开发者ID:ianturton,项目名称:geotools-cookbook,代码行数:20,代码来源:FilterExamples.java

示例2: createBaseFilter

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
/**
 * Creates a base filter that will return a small subset of our results. This can be tweaked to
 * return different results if desired. Currently it should return 16 results.
 *
 * @return
 *
 * @throws org.geotools.filter.text.cql2.CQLException
 * @throws java.io.IOException
 */
static Filter createBaseFilter()
        throws CQLException, IOException {

    // Get a FilterFactory2 to build up our query
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    // We are going to query for events in Ukraine during the
    // civil unrest.

    // We'll start by looking at a particular time frame
    Filter timeFilter =
            ff.between(ff.property(Attributes.SQLDATE.getName()),
                       ff.literal("2013-01-01T05:00:00.000Z"),
                       ff.literal("2014-04-30T23:00:00.000Z"));

    // We'll bound our query spatially to Ukraine
    Filter spatialFilter =
            ff.bbox(Attributes.geom.getName(),
                    31.6, 44, 37.4, 47.75,
                    "EPSG:4326");

    // we'll also restrict our query to only articles about the US, UK or UN
    Filter attributeFilter = ff.like(ff.property(Attributes.Actor1Name.getName()), "UNITED%");

    // Now we can combine our filters using a boolean AND operator
    Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter));

    return conjunction;
}
 
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:39,代码来源:GeoServerAuthorizationsTutorial.java

示例3: queryGdelt

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
public static void queryGdelt(String[] args) throws Exception {
    CommandLineParser parser = new BasicParser();
    Options options = GDELTIngest.getCommonRequiredOptions();

    CommandLine cmd = parser.parse( options, args);
    Map<String, String> dsConf = GDELTIngest.getAccumuloDataStoreConf(cmd);

    String featureName = cmd.getOptionValue(GDELTIngest.FEATURE_NAME);

    // First, we get a handle to the data store and feature source
    DataStore ds = DataStoreFinder.getDataStore(dsConf);
    SimpleFeatureSource fs = ds.getFeatureSource(featureName);

    // Next, we form a query.  We need a FilterFactory2 to build
    // up our query
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    // We want to query for events in Ukraine during the
    // civil unrest.  We'll start by looking at January and February
    // of 2014
    DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    Date start = df.parse("2014-01-01");
    Date end = df.parse("2014-02-28");
    Filter timeFilter = ff.between(ff.property("SQLDATE"), ff.literal(start), ff.literal(end));

    // We need to bound our query spatially to Ukraine
    Filter spatialFilter = ff.bbox("geom", 22.1371589, 44.386463, 40.228581, 52.379581, "EPSG:4326");

    // Now we can combine our time filter and our spatial filter using a boolean and operator
    Filter conjunction = ff.and(timeFilter, spatialFilter);

    // Let's constrain the results to just the date/time, location, and Actor names
    Query query = new Query("gdelt", conjunction, new String[]{ "SQLDATE", "geom", "Actor1Name", "Actor2Name" });

    // Finally, we submit our query to GeoMesa
    SimpleFeatureCollection results = fs.getFeatures(query);

    System.out.println("Number of results = " + results.size());

    // We can add an attribute filter
    Filter actor1Protest = ff.like(ff.property("Actor1Name"), "PROTEST%");
    Filter spatialTemporalAttribute = ff.and(conjunction, actor1Protest);
    Query query2 = new Query("gdelt", spatialTemporalAttribute, new String[]{ "SQLDATE", "geom", "Actor1Name", "Actor2Name" });
    SimpleFeatureCollection results2 = fs.getFeatures(query2);

    System.out.println("Number of results = " + results2.size());

    Filter eventRootCodeThreaten =  ff.equal(ff.property("EventRootCode"), ff.literal(13), false);
    Filter spatialTemporalAttribute2 = ff.and(conjunction, eventRootCodeThreaten);
    Query query3 = new Query("gdelt", spatialTemporalAttribute2, new String[]{ "SQLDATE", "geom", "Actor1Name", "Actor2Name", "EventRootCode", "EventBaseCode" });
    SimpleFeatureCollection results3 = fs.getFeatures(query3);

    System.out.println("Number of results = " + results3.size());
}
 
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:55,代码来源:GDELTQuery.java

示例4: createBaseFilter

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
/**
     * Creates a base filter that will return a small subset of our results. This can be tweaked to
     * return different results if desired. Currently it should return 16 results.
     *
     * @return
     *
     * @throws CQLException
     * @throws IOException
     */
    static Filter createBaseFilter()
            throws CQLException, IOException {

        // Get a FilterFactory2 to build up our query
        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

        // We are going to query for events in Ukraine during the
        // civil unrest.

        // We'll start by looking at a particular day in February of 2014
        Calendar calendar = Calendar.getInstance();
        calendar.clear();
        calendar.set(Calendar.YEAR, 2013);
        calendar.set(Calendar.MONTH, Calendar.JANUARY);
        calendar.set(Calendar.DAY_OF_MONTH, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        Date start = calendar.getTime();

        calendar.set(Calendar.YEAR, 2014);
        calendar.set(Calendar.MONTH, Calendar.APRIL);
        calendar.set(Calendar.DAY_OF_MONTH, 30);
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        Date end = calendar.getTime();
//        2013-01-01T00:00:00.000Z/2014-04-30T23:00:00.000Z
        Filter timeFilter =
                ff.between(ff.property(GdeltFeature.Attributes.SQLDATE.getName()),
                           ff.literal(start),
                           ff.literal(end));

        // We'll bound our query spatially to Ukraine
        Filter spatialFilter =
                ff.bbox(GdeltFeature.Attributes.geom.getName(),
                        31.6, 44, 37.4, 47.75,
                        "EPSG:4326");

        // we'll also restrict our query to only articles about the US, UK or UN
        Filter attributeFilter = ff.like(ff.property(GdeltFeature.Attributes.Actor1Name.getName()),
                                         "UNITED%");

        // Now we can combine our filters using a boolean AND operator
        Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter));

        return conjunction;
    }
 
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:54,代码来源:AuthorizationsTutorial.java

示例5: createBaseFilter

import org.opengis.filter.FilterFactory2; //导入方法依赖的package包/类
/**
 * Creates a base filter that will return a small subset of our results. This can be tweaked to
 * return different results if desired. Currently it should return 16 results.
 *
 * @return
 *
 * @throws CQLException
 * @throws IOException
 */
static Filter createBaseFilter()
        throws CQLException, IOException {

    // Get a FilterFactory2 to build up our query
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2();

    // We are going to query for events in Ukraine during the
    // civil unrest.

    // We'll start by looking at a particular day in February of 2014
    Calendar calendar = Calendar.getInstance();
    calendar.clear();
    calendar.set(Calendar.YEAR, 2014);
    calendar.set(Calendar.MONTH, Calendar.FEBRUARY);
    calendar.set(Calendar.DAY_OF_MONTH, 2);
    calendar.set(Calendar.HOUR_OF_DAY, 0);
    Date start = calendar.getTime();

    calendar.set(Calendar.HOUR_OF_DAY, 23);
    Date end = calendar.getTime();

    Filter timeFilter =
            ff.between(ff.property(GdeltFeature.Attributes.SQLDATE.getName()),
                       ff.literal(start),
                       ff.literal(end));

    // We'll bound our query spatially to Ukraine
    Filter spatialFilter =
            ff.bbox(GdeltFeature.Attributes.geom.getName(),
                    22.1371589,
                    44.386463,
                    40.228581,
                    52.379581,
                    "EPSG:4326");

    // we'll also restrict our query to only articles about the US, UK or UN
    Filter attributeFilter = ff.like(ff.property(GdeltFeature.Attributes.Actor1Name.getName()),
                                     "UNITED%");

    // Now we can combine our filters using a boolean AND operator
    Filter conjunction = ff.and(Arrays.asList(timeFilter, spatialFilter, attributeFilter));

    return conjunction;
}
 
开发者ID:geomesa,项目名称:geomesa-tutorials,代码行数:54,代码来源:QueryTutorial.java


注:本文中的org.opengis.filter.FilterFactory2.and方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。