コード例 #1
0
ファイル: test_feature.py プロジェクト: mwtoews/Fiona
 def test_geometry(self):
     f = { 'id': '1',
           'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)},
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.assertEqual(
         sorted(g['geometry'].items()),
         [('coordinates', (0.0, 0.0)), ('type', 'Point')])
コード例 #2
0
ファイル: test_feature.py プロジェクト: visr/Fiona
 def test_geometry(self):
     f = { 'id': '1', 
           'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)},
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.failUnlessEqual(
         sorted(g['geometry'].items()),
         [('coordinates', (0.0, 0.0)), ('type', 'Point')])
コード例 #3
0
ファイル: test_feature.py プロジェクト: fredj/Fiona
 def test_point(self):
     f = { 'id': '1', 
           'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)},
           'properties': {'title': u'foo'} }
     schema = {'geometry': 'Point', 'properties': {'title': 'str'}}
     with collection("/tmp/foo.shp", "w", "ESRI Shapefile", schema) as c:
         g = featureRT(f, c)
         self.failUnless(g.has_key('id'))
         self.failUnlessEqual(g['properties']['title'], 'foo')
コード例 #4
0
ファイル: test_feature.py プロジェクト: visr/Fiona
 def test_geometry(self):
     f = { 'id': '1', 
           'geometry': { 'type': 'LineString', 
                         'coordinates': [(0.0, 0.0), (1.0, 1.0)] },
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.failUnlessEqual(
         sorted(g['geometry'].items()),
         [('coordinates', [(0.0, 0.0), (1.0, 1.0)]), 
          ('type', 'LineString')])
コード例 #5
0
ファイル: test_feature.py プロジェクト: mwtoews/Fiona
 def test_geometry(self):
     f = { 'id': '1',
           'geometry': { 'type': 'LineString',
                         'coordinates': [(0.0, 0.0), (1.0, 1.0)] },
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.assertEqual(
         sorted(g['geometry'].items()),
         [('coordinates', [(0.0, 0.0), (1.0, 1.0)]),
          ('type', 'LineString')])
コード例 #6
0
ファイル: test_feature.py プロジェクト: visr/Fiona
 def test_properties(self):
     f = { 'id': '1', 
           'geometry': { 'type': 'Polygon', 
                         'coordinates': 
                             [[(0.0, 0.0), 
                               (0.0, 1.0), 
                               (1.0, 1.0), 
                               (1.0, 0.0), 
                               (0.0, 0.0)]] },
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.failUnlessEqual(g['properties']['title'], 'foo')
コード例 #7
0
ファイル: test_feature.py プロジェクト: mwtoews/Fiona
 def test_properties(self):
     f = { 'id': '1',
           'geometry': { 'type': 'Polygon',
                         'coordinates':
                             [[(0.0, 0.0),
                               (0.0, 1.0),
                               (1.0, 1.0),
                               (1.0, 0.0),
                               (0.0, 0.0)]] },
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.assertEqual(g['properties']['title'], 'foo')
コード例 #8
0
 def test_none_property(self):
     f = {
         'id': '1',
         'geometry': {
             'type': 'Point',
             'coordinates': (0.0, 0.0)
         },
         'properties': {
             'title': None
         }
     }
     g = featureRT(f, self.c)
     self.failUnlessEqual(g['properties']['title'], None)
コード例 #9
0
 def test_properties(self):
     f = {
         'id': '1',
         'geometry': {
             'type': 'Point',
             'coordinates': (0.0, 0.0)
         },
         'properties': {
             'title': u'foo'
         }
     }
     g = featureRT(f, self.c)
     assert g['properties']['title'] == 'foo'
コード例 #10
0
 def test_none_property(self):
     f = {
         'id': '1',
         'geometry': {
             'type': 'Point',
             'coordinates': (0.0, 0.0)
         },
         'properties': {
             'title': None
         }
     }
     g = featureRT(f, self.c)
     assert g['properties']['title'] is None
コード例 #11
0
 def test_properties(self):
     f = {
         'id': '1',
         'geometry': {
             'type':
             'Polygon',
             'coordinates': [[(0.0, 0.0), (0.0, 1.0), (1.0, 1.0),
                              (1.0, 0.0), (0.0, 0.0)]]
         },
         'properties': {
             'title': u'foo'
         }
     }
     g = featureRT(f, self.c)
     assert g['properties']['title'] == 'foo'
コード例 #12
0
ファイル: test_feature.py プロジェクト: ingenieroariel/Fiona
 def test_point(self):
     f = {
         'id': '1',
         'geometry': {
             'type': 'Point',
             'coordinates': (0.0, 0.0)
         },
         'properties': {
             'title': u'foo'
         }
     }
     schema = {'geometry': 'Point', 'properties': {'title': 'str'}}
     with collection("/tmp/foo.shp", "w", "ESRI Shapefile", schema) as c:
         g = featureRT(f, c)
         self.failUnless(g.has_key('id'))
         self.failUnlessEqual(g['properties']['title'], 'foo')
コード例 #13
0
 def test_geometry(self):
     f = {
         'id': '1',
         'geometry': {
             'type':
             'Polygon',
             'coordinates': [[(0.0, 0.0), (0.0, 1.0), (1.0, 1.0),
                              (1.0, 0.0), (0.0, 0.0)]]
         },
         'properties': {
             'title': u'foo'
         }
     }
     g = featureRT(f, self.c)
     self.assertEqual(sorted(g['geometry'].items()),
                      [('coordinates', [[(0.0, 0.0), (0.0, 1.0), (1.0, 1.0),
                                         (1.0, 0.0), (0.0, 0.0)]]),
                       ('type', 'Polygon')])
コード例 #14
0
ファイル: test_feature.py プロジェクト: Toblerity/Fiona
 def test_geometry(self):
     f = { 'id': '1',
           'geometry': { 'type': 'Polygon',
                         'coordinates':
                             [[(0.0, 0.0),
                               (0.0, 1.0),
                               (1.0, 1.0),
                               (1.0, 0.0),
                               (0.0, 0.0)]] },
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     assert (
         sorted(g['geometry'].items()) ==
         [('coordinates', [[(0.0, 0.0),
                               (0.0, 1.0),
                               (1.0, 1.0),
                               (1.0, 0.0),
                               (0.0, 0.0)]]),
          ('type', 'Polygon')])
コード例 #15
0
ファイル: test_feature.py プロジェクト: mwtoews/Fiona
 def test_none_property(self):
     f = { 'id': '1',
           'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)},
           'properties': {'title': None} }
     g = featureRT(f, self.c)
     self.assertEqual(g['properties']['title'], None)
コード例 #16
0
ファイル: test_feature.py プロジェクト: Toblerity/Fiona
 def test_properties(self):
     f = { 'id': '1',
           'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)},
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     assert g['properties']['title'] == 'foo'
コード例 #17
0
ファイル: test_feature.py プロジェクト: MatthewArrott/Fiona
 def test_properties(self):
     f = { 'id': '1',
           'geometry': {'type': 'Point', 'coordinates': (0.0, 0.0)},
           'properties': {'title': u'foo'} }
     g = featureRT(f, self.c)
     self.failUnlessEqual(g['properties']['title'], 'foo')