How to use the fastkml.geometry.Point function in fastkml

To help you get started, we’ve selected a few fastkml examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cleder / fastkml / fastkml / test_main.py View on Github external
def testMultiPoint(self):
        p0 = Point(0, 1)
        p1 = Point(1, 1)
        g = Geometry(geometry=MultiPoint([p0, p1]))
        self.assertTrue('MultiGeometry' in str(g.to_string()))
        self.assertTrue('Point' in str(g.to_string()))
        self.assertTrue('coordinates>0.000000,1.0000001.000000,1.000000
github cleder / fastkml / fastkml / test_main.py View on Github external
def test_extrude(self):
        geom = Geometry()
        self.assertEqual(geom.extrude, False)
        geom.geometry = Point(0, 1)
        geom.extrude = False
        self.assertFalse('extrude' in str(geom.to_string()))
        geom.extrude = True
        geom.altitude_mode = 'clampToGround'
        self.assertFalse('extrude' in str(geom.to_string()))
        geom.altitude_mode = 'relativeToGround'
        self.assertTrue('extrude>11
github cleder / fastkml / fastkml / test_main.py View on Github external
def test_placemark(self):
        ns = '{http://www.opengis.net/kml/2.2}'
        k = kml.KML(ns=ns)
        p = kml.Placemark(ns, 'id', 'name', 'description')
        p.geometry = Point(0.0, 0.0, 0.0)
        p2 = kml.Placemark(ns, 'id2', 'name2', 'description2')
        p2.geometry = LineString([(0, 0, 0), (1, 1, 1)])
        k.append(p)
        k.append(p2)
        self.assertEqual(len(list(k.features())), 2)
        k2 = kml.KML()
        k2.from_string(k.to_string(prettyprint=True))
        self.assertEqual(k.to_string(), k2.to_string())
github cleder / fastkml / fastkml / test_main.py View on Github external
def testPoint(self):
        p = Point(0, 1)
        g = Geometry(geometry=p)
        self.assertEqual(g.geometry, p)
        g = Geometry(geometry=p.__geo_interface__)
        self.assertEqual(g.geometry.__geo_interface__, p.__geo_interface__)
        self.assertTrue('Point' in str(g.to_string()))
        self.assertTrue('coordinates>0.000000,1.000000
github cleder / fastkml / fastkml / test_main.py View on Github external
def testGeometryCollection(self):
        po = Polygon([(3, 0), (4, 0), (4, 1), (3, 0)])
        lr = LinearRing([(0, -1), (1, -1), (1, 1), (0, -1)])
        ls = LineString([(0, 0), (1, 1)])
        p = Point(0, 1)
        # geo_if = {'type': 'GeometryCollection', 'geometries': [
        #     po.__geo_interface__, p.__geo_interface__,
        #     ls.__geo_interface__, lr.__geo_interface__]}
        g = Geometry(geometry=GeometryCollection([po, p, ls, lr]))
        # g1 = Geometry(geometry=as_shape(geo_if))
        # self.assertEqual(g1.__geo_interface__, g.__geo_interface__)
        self.assertTrue('MultiGeometry' in str(g.to_string()))
        self.assertTrue('Polygon' in str(g.to_string()))
        self.assertTrue('outerBoundaryIs' in str(g.to_string()))
        self.assertFalse('innerBoundaryIs' in str(g.to_string()))
        self.assertTrue('LinearRing' in str(g.to_string()))
        self.assertTrue(
            'coordinates>3.000000,0.000000 4.000000,0.000000 4.000000,1.000000 3.000000,0.0000000.000000,0.000000 1.000000,1.000000
github cleder / fastkml / fastkml / test_main.py View on Github external
self.assertFalse('tessellate' in str(geom.to_string()))
        geom.altitude_mode = 'relativeToGround'
        self.assertFalse('tessellate' in str(geom.to_string()))
        geom.altitude_mode = 'absolute'
        self.assertFalse('tessellate' in str(geom.to_string()))
        geom.tessellate = True
        geom.altitude_mode = None
        self.assertFalse('tessellate' in str(geom.to_string()))
        geom.altitude_mode = 'relativeToGround'
        self.assertFalse('tessellate' in str(geom.to_string()))
        geom.altitude_mode = 'absolute'
        self.assertFalse('tessellate' in str(geom.to_string()))
        geom.altitude_mode = 'clampToGround'
        self.assertTrue('tessellate>1
github cleder / fastkml / fastkml / test_main.py View on Github external
def test_untyped_extended_data(self):
        ns = '{http://www.opengis.net/kml/2.2}'
        k = kml.KML(ns=ns)

        p = kml.Placemark(ns, 'id', 'name', 'description')
        p.geometry = Point(0.0, 0.0, 0.0)
        p.extended_data = kml.UntypedExtendedData(elements=[
            kml.UntypedExtendedDataElement(
                name='info', value='so much to see'
            ),
            kml.UntypedExtendedDataElement(
                name='weather', display_name='Weather', value='blue skies'
            )
        ])

        self.assertEqual(len(p.extended_data.elements), 2)
        k.append(p)

        k2 = kml.KML()
        k2.from_string(k.to_string(prettyprint=True))
        k.to_string()
github cleder / fastkml / fastkml / test_main.py View on Github external
def testMultiPoint(self):
        p0 = Point(0, 1)
        p1 = Point(1, 1)
        g = Geometry(geometry=MultiPoint([p0, p1]))
        self.assertTrue('MultiGeometry' in str(g.to_string()))
        self.assertTrue('Point' in str(g.to_string()))
        self.assertTrue('coordinates>0.000000,1.0000001.000000,1.000000
github cleder / fastkml / fastkml / test_main.py View on Github external
def test_altitude_mode(self):
        geom = Geometry()
        geom.geometry = Point(0, 1)
        self.assertEqual(geom.altitude_mode, None)
        self.assertFalse('altitudeMode' in str(geom.to_string()))
        geom.altitude_mode = 'unknown'
        self.assertRaises(AssertionError, geom.to_string)
        geom.altitude_mode = 'clampToSeaFloor'
        self.assertRaises(AssertionError, geom.to_string)
        geom.altitude_mode = 'relativeToSeaFloor'
        self.assertRaises(AssertionError, geom.to_string)
        geom.altitude_mode = 'clampToGround'
        self.assertFalse('altitudeMode' in str(geom.to_string()))
        geom.altitude_mode = 'relativeToGround'
        self.assertTrue('altitudeMode>relativeToGroundabsolute