def testWriteGML3(self): g = geom.Point(-125, 50) a = {'x': 1, 'y': 1.1, 'z': 'one', 'geom': g} xml = feature.writeGML(feature.Feature(a,'fid'), ver=3) doc = dom.parseString(xml) assert "gsf:feature" == doc.documentElement.nodeName xp = Feature_Test.xpathctx assert u'1' in xp.findvalues('//gsf:x', doc) assert u'1.1' in xp.findvalues('//gsf:y', doc) assert u'one' in xp.findvalues('//gsf:z', doc) self.assertIn(u'-125 50', xp.findvalues('//gsf:geom/gml:Point/gml:pos', doc))
def testWriteGML3(self): g = geom.Point(-125, 50) a = {"x": 1, "y": 1.1, "z": "one", "geom": g} xml = feature.writeGML(feature.Feature(a, "fid"), ver=3) doc = dom.parseString(xml) assert "gsf:feature" == doc.documentElement.nodeName xp = Feature_Test.xpathctx assert u"1" in xp.findvalues("//gsf:x", doc) assert u"1.1" in xp.findvalues("//gsf:y", doc) assert u"one" in xp.findvalues("//gsf:z", doc) assert u"-125.0 50.0" in xp.findvalues("//gsf:geom/gml:Point/gml:pos", doc)
def testWriteGML3(self): g = geom.Point(-125, 50) a = {'x': 1, 'y': 1.1, 'z': 'one', 'geom': g} xml = feature.writeGML(feature.Feature(a,'fid'), ver=3) doc = dom.parseString(xml) assert "gsf:feature" == doc.documentElement.nodeName xp = Feature_Test.xpathctx assert u'1' in xp.findvalues('//gsf:x', doc) assert u'1.1' in xp.findvalues('//gsf:y', doc) assert u'one' in xp.findvalues('//gsf:z', doc) assert u'-125.0 50.0' in xp.findvalues('//gsf:geom/gml:Point/gml:pos', doc)
def testWriteGML(self): g = geom.Point(-125, 50) a = {'x': 1, 'y': 1.1, 'z': 'one', 'geom': g} xml = feature.writeGML(feature.Feature(a,'fid')) doc = dom.parseString(xml) assert "gsf:feature" == doc.documentElement.nodeName xp = Feature_Test.xpathctx assert u'1' in xp.findvalues('//gsf:x', doc) assert u'1.1' in xp.findvalues('//gsf:y', doc) assert u'one' in xp.findvalues('//gsf:z', doc) assert -125.0 == float(xp.findvalues('//gsf:geom/gml:Point/gml:coord/gml:X', doc)[0] ) assert 50.0 == float(xp.findvalues('//gsf:geom/gml:Point/gml:coord/gml:Y', doc)[0] )
def testWriteGML32(self): g = geom.Point(-125, 50) a = {'x': 1, 'y': 1.1, 'z': 'one', 'geom': g} xml = feature.writeGML(feature.Feature(a,'fid'), ver=3.2) doc = dom.parseString(xml) assert "gsf:feature" == doc.documentElement.nodeName xp = Feature_Test.xpathctx xp.namespaces['gml'] = 'http://www.opengis.net/gml/3.2' assert u'1' in xp.findvalues('//gsf:x', doc) assert u'1.1' in xp.findvalues('//gsf:y', doc) assert u'one' in xp.findvalues('//gsf:z', doc) assert u'-125.0 50.0' in xp.findvalues('//gsf:geom/gml:Point/gml:pos', doc)
def testWriteGML32(self): g = geom.Point(-125, 50) a = {'x': 1, 'y': 1.1, 'z': 'one', 'geom': g} xml = feature.writeGML(feature.Feature(a, 'fid'), ver=3.2) doc = dom.parseString(xml) assert "gsf:feature" == doc.documentElement.nodeName xp = Feature_Test.xpathctx xp.namespaces['gml'] = 'http://www.opengis.net/gml/3.2' assert u'1' in xp.findvalues('//gsf:x', doc) assert u'1.1' in xp.findvalues('//gsf:y', doc) assert u'one' in xp.findvalues('//gsf:z', doc) self.assertIn(u'-125 50', xp.findvalues('//gsf:geom/gml:Point/gml:pos', doc))