Esempio n. 1
0
  def testSort(self):
    # check that the layer supports sorting
    ff = CommonFactoryFinder.getFilterFactory(None)
    sortBy = ff.sort('STATE_NAME', SortOrder.ASCENDING)
    if not self.l._source.getQueryCapabilities().supportsSorting([sortBy]):
      return

    c = self.l.cursor(sort=('STATE_NAME'))
    assert 'Alabama' == c.next()['STATE_NAME']
    assert 'Arizona' == c.next()['STATE_NAME']
    assert 'Arkansas' == c.next()['STATE_NAME']
    c.close()

    c = self.l.cursor(sort=('STATE_NAME', 'DESC'))
    assert 'Wyoming' == c.next()['STATE_NAME']
    assert 'Wisconsin' == c.next()['STATE_NAME']
    assert 'West Virginia' == c.next()['STATE_NAME']
    c.close()
Esempio n. 2
0
    def testSort(self):
        # check that the layer supports sorting
        ff = CommonFactoryFinder.getFilterFactory(None)
        sortBy = ff.sort('STATE_NAME', SortOrder.ASCENDING)
        if not self.l._source.getQueryCapabilities().supportsSorting([sortBy]):
            return

        c = self.l.cursor(sort=('STATE_NAME'))
        assert 'Alabama' == c.next()['STATE_NAME']
        assert 'Arizona' == c.next()['STATE_NAME']
        assert 'Arkansas' == c.next()['STATE_NAME']
        c.close()

        c = self.l.cursor(sort=('STATE_NAME', 'DESC'))
        assert 'Wyoming' == c.next()['STATE_NAME']
        assert 'Wisconsin' == c.next()['STATE_NAME']
        assert 'West Virginia' == c.next()['STATE_NAME']
        c.close()
Esempio n. 3
0
from java import net
from cursor import Cursor
from geoscript import core, geom, proj, feature, util
from geoscript.filter import Filter
from geoscript.layer.stats import Stats
from geoscript.util.data import readFeatures
from org.geoscript.util import CollectionDelegatingFeatureSource
from org.geotools.data import FeatureSource, FeatureStore
from org.geotools.data import DefaultQuery, Query, Transaction, DefaultTransaction
from org.geotools.factory import CommonFactoryFinder
from org.geotools.feature import FeatureCollection, FeatureCollections
from org.opengis.filter.sort import SortOrder
import sys,traceback


_filterFactory = CommonFactoryFinder.getFilterFactory(None)

class Layer(object):
  """
  A source of spatial data.
  """

  _id = -1
  """
  Internal counter for generating layer names
  """

  def __init__(self, name=None, workspace=None, source=None, schema=None):
    if not workspace:
       from geoscript.workspace import Memory
       workspace = Memory()
Esempio n. 4
0
 def __init__(self):
     self.style_factory = CommonFactoryFinder.getStyleFactory(None)
     self.filter_factory = CommonFactoryFinder.getFilterFactory(None)
Esempio n. 5
0
from org.geotools.factory import CommonFactoryFinder
from org.geotools.styling import StyleFactoryImpl, StyleBuilder

_filter = CommonFactoryFinder.getFilterFactory(None)

class StyleFactory(StyleFactoryImpl):

  def __init__(self):
    self.builder = StyleBuilder()
    self.filter = _filter

  def createStyle(self):
    return self.builder.createStyle()

  def createFill(self):
    return self.builder.createFill()

  def createFont(self, family, italic, bold, size):
    return self.builder.createFont(family, italic, bold, size)

  def createGraphic(self):
    return self.builder.createGraphic()