def test_it_saves_to_string(self):
     text = """{"type": "MultiPolygon", "coordinates": [[[[1, 2], [3, 4], [5, 6], [1, 2]]]]}"""
     multipolygon = GeoJSON.loadFromString(text)
     savedtext = multipolygon.saveToString()
     self.assertEqual(text, savedtext)
 def test_it_saves_to_string(self):
     text = """{"type": "FeatureCollection", "features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"foo": 42}}]}"""
     featurecollection = GeoJSON.loadFromString(text)
     savedtext = featurecollection.saveToString()
     self.assertEqual(text, savedtext)
 def test_it_loads_geojson_object_from_string(self):
     text = """{"type": "Point", "coordinates": [102.0, 0.5]}"""
     point = GeoJSON.loadFromString(text)
     self.assertEqual(102.0, point.lat)
     self.assertEqual(0.5, point.lon)
 def test_it_saves_to_string(self):
     text = """{"type": "LineString", "coordinates": [[101, 0.6], [102.0, 0.5]]}"""
     linestring = GeoJSON.loadFromString(text)
     savedtext = linestring.saveToString()
     self.assertEqual(text, savedtext)
 def test_it_returns_point_instance(self):
     text = """{"type": "Point", "coordinates": [102.0, 0.5]}"""
     point = GeoJSON.loadFromString(text)
     self.assertEqual("Point", point.getType())
 def test_it_saves_to_string(self):
     text = """{"type": "Point", "coordinates": [102.0, 0.5]}"""
     point = GeoJSON.loadFromString(text)
     savedtext = point.saveToString()
     self.assertEqual(text, savedtext)
Beispiel #7
0
 def test_it_loads_geojson_object_from_string(self):
     text = """{"type": "MultiPoint", "coordinates": [[101, 0.6], [102.0, 0.5]]}"""
     multipoint = GeoJSON.loadFromString(text)
     self.assertEqual(102.0, multipoint.lat(1))
     self.assertEqual(0.6, multipoint.lon(0))
     self.assertEqual(2, len(multipoint))
Beispiel #8
0
 def test_it_saves_to_string(self):
     text = """{"type": "MultiPoint", "coordinates": [[101, 0.6], [102.0, 0.5]]}"""
     multipoint = GeoJSON.loadFromString(text)
     savedtext = multipoint.saveToString()
     self.assertEqual(text, savedtext)
Beispiel #9
0
 def test_it_returns_point_instance(self):
     text = """{"type": "MultiPoint", "coordinates": [[101, 0.6], [102.0, 0.5]]}"""
     multipoint = GeoJSON.loadFromString(text)
     self.assertEqual("MultiPoint", multipoint.getType())
Beispiel #10
0
 def test_it_saves_id(self):
     text = """{"type": "Feature", "geometry": null, "properties": {"foo": 42}, "id": 999}"""
     feature = GeoJSON.loadFromString(text)
     savedtext = feature.saveToString()
     self.assertEqual(text, savedtext)
Beispiel #11
0
 def test_it_saves_to_string(self):
     text = """{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [102.0, 0.5]}]}"""
     geometrycollection = GeoJSON.loadFromString(text)
     savedtext = geometrycollection.saveToString()
     self.assertEqual(text, savedtext)