Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def print_obj(to_print, verbose=False):
"""
Print method to help with debugging.
"""
if isinstance(to_print, GeoWaveObject):
to_print = to_print._java_ref
print(java_gateway.entry_point.getDebug().printObject(to_print, verbose))
#
# Copyright (c) 2013-2019 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
# available at http://www.apache.org/licenses/LICENSE-2.0.txt
#===============================================================================================
from pygw.base import GeoWaveObject
from pygw.base.type_conversions import GeometryType
from .simple_feature_type import SimpleFeatureType
class SimpleFeature(GeoWaveObject):
"""
A Simple (Vector) Feature.
"""
def __init__(self, feature_type, java_ref):
assert isinstance(feature_type, SimpleFeatureType)
self._feature_type = feature_type
super().__init__(java_ref)
def get_id(self):
"""
Returns:
The ID of the feature.
"""
return self._java_ref.getID()
#
# Copyright (c) 2013-2019 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
# available at http://www.apache.org/licenses/LICENSE-2.0.txt
#===============================================================================================
from pygw.base import GeoWaveObject
class SimpleFeatureType(GeoWaveObject):
"""
Defines a schema for vector features.
"""
def __init__(self, java_ref, attributes):
self.attribute_dict = {}
for a in attributes:
self.attribute_dict[a.descriptor] = a
self.attribute_list = attributes
super().__init__(java_ref)
def get_type_name(self):
"""
Returns:
The name of the feature type.
"""
#
# Copyright (c) 2013-2019 Contributors to the Eclipse Foundation
#
# See the NOTICE file distributed with this work for additional information regarding copyright
# ownership. All rights reserved. This program and the accompanying materials are made available
# under the terms of the Apache License, Version 2.0 which accompanies this distribution and is
# available at http://www.apache.org/licenses/LICENSE-2.0.txt
#===============================================================================================
from pygw.base import GeoWaveObject
from .index import Index
class IndexBuilder(GeoWaveObject):
"""
Base class for building indices.
"""
def set_num_partitions(self, num_partitions):
"""
Sets the number of partitions for the index to use.
Args:
num_partitions (int): The number of partitions to use.
Returns:
This index builder.
"""
self._java_ref.setNumPartitions(num_partitions)
return self
filter_list.append(filter)
objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
objects_array[0] = filter_list
return method.invoke(j_filter_factory, objects_array)
def _invoke_filter_method_by_name(j_filter_factory, name, filter):
filter_factory_class = j_filter_factory.getClass()
filter_class = reflection_util.classForName("org.opengis.filter.Filter")
class_array = java_gateway.new_array(java_pkg.java.lang.Class, 1)
class_array[0] = filter_class
method = filter_factory_class.getMethod(name, class_array)
objects_array = java_gateway.new_array(java_pkg.java.lang.Object, 1)
objects_array[0] = filter
return method.invoke(j_filter_factory, objects_array)
class FilterFactory(GeoWaveObject):
"""
Filter factory for constructing filters to be used in vector queries. Methods
of this factory generally return either a Filter or Expression which can be used
in additional method calls.
"""
def __init__(self):
j_filter_factory = java_pkg.org.geotools.filter.FilterFactoryImpl()
super().__init__(j_filter_factory)
def id(self, fids):
"""
Constructs a filter that matches a set of feature IDs.
Args:
fids (list of str): The list of feature IDs to match.