Commit 328efdf7 authored by Christian Ledermann's avatar Christian Ledermann

make shapely an option, rely on pygeoif for the geometries instead

parent c1120cd4
...@@ -24,7 +24,12 @@ I wonder if the "geojson" package fits ...@@ -24,7 +24,12 @@ I wonder if the "geojson" package fits
the purpose or it's rather better to implement to protocol from scratch. the purpose or it's rather better to implement to protocol from scratch.
""" """
from shapely.geometry import Point, LineString, Polygon try:
from shapely.geometry import MultiPoint, MultiLineString, MultiPolygon from shapely.geometry import Point, LineString, Polygon
from shapely.geometry.polygon import LinearRing from shapely.geometry import MultiPoint, MultiLineString, MultiPolygon
from shapely.geometry.polygon import LinearRing
except ImportError:
from pygeoif.geometry import Point, LineString, Polygon
from pygeoif.geometry import MultiPoint, MultiLineString, MultiPolygon
from pygeoif.geometry import LinearRing
...@@ -23,9 +23,9 @@ from fastkml import atom ...@@ -23,9 +23,9 @@ from fastkml import atom
from fastkml import config from fastkml import config
import datetime import datetime
import xml.etree.ElementTree as etree import xml.etree.ElementTree as etree
from shapely.geometry import Point, LineString, Polygon from fastkml.geometry import Point, LineString, Polygon
from shapely.geometry import MultiPoint, MultiLineString, MultiPolygon from fastkml.geometry import MultiPoint, MultiLineString, MultiPolygon
from shapely.geometry.polygon import LinearRing from fastkml.geometry import LinearRing
class BaseClassesTestCase(unittest.TestCase): class BaseClassesTestCase(unittest.TestCase):
""" BaseClasses must raise a NotImplementedError on etree_element """ BaseClasses must raise a NotImplementedError on etree_element
...@@ -427,6 +427,9 @@ class KmlFromStringTestCase( unittest.TestCase ): ...@@ -427,6 +427,9 @@ class KmlFromStringTestCase( unittest.TestCase ):
k2.from_string(k.to_string()) k2.from_string(k.to_string())
self.assertEqual(k.to_string(), k2.to_string()) self.assertEqual(k.to_string(), k2.to_string())
def test_atom(self):
pass
class StyleTestCase( unittest.TestCase ): class StyleTestCase( unittest.TestCase ):
def test_styleurl(self): def test_styleurl(self):
...@@ -438,6 +441,9 @@ class StyleTestCase( unittest.TestCase ): ...@@ -438,6 +441,9 @@ class StyleTestCase( unittest.TestCase ):
f.styleUrl = s f.styleUrl = s
self.assertTrue(isinstance(f._styleUrl, styles.StyleUrl)) self.assertTrue(isinstance(f._styleUrl, styles.StyleUrl))
self.assertEqual(f.styleUrl, '#otherstyle') self.assertEqual(f.styleUrl, '#otherstyle')
f2 = kml.Document()
f2.from_string(f.to_string())
self.assertEqual(f.to_string(), f2.to_string())
......
...@@ -27,7 +27,7 @@ setup(name='fastkml', ...@@ -27,7 +27,7 @@ setup(name='fastkml',
zip_safe=False, zip_safe=False,
install_requires=[ install_requires=[
# -*- Extra requirements: -*- # -*- Extra requirements: -*-
'shapely', 'pygeoif',
'python-dateutil', 'python-dateutil',
], ],
entry_points=""" entry_points="""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment