def test_line_write(self): p = Line([(100.0, 0.0), (101.0, 1.0)], crs=LonLatWGS84) s = p.as_geojson(urn="urn:ogc:def:crs:EPSG::5806") ans = """{ "type": "Feature", "properties": {}, "geometry": { "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::5806" } }, "coordinates": [ [ 100.0, 0.0 ], [ 101.0, 1.0 ] ], "type": "LineString" } }""" self.verifyJson(s, ans) return
def test_line_write(self): p = Line([(100.0, 0.0), (101.0, 1.0)], crs=LonLatWGS84) s = p.as_geojson(urn="urn:ogc:def:crs:EPSG::5806") ans = """{ "type": "Feature", "properties": {}, "geometry": { "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:EPSG::5806" } }, "coordinates": [ [ 100.0, 0.0 ], [ 101.0, 1.0 ] ], "type": "LineString" } }""" self.verifyJson(s, ans) return
def test_write_reproject(self): # tests whether coordinates are correctly reprojected to WGS84 lon/lat p = Line([(1e6, 1e6), (1.2e6, 1.4e6)], crs=WebMercator) s = p.as_geojson() ans = """{ "type": "Feature", "properties": {}, "geometry": { "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "coordinates": [[8.983152841195214, 8.946573850543412], [10.779783409434257, 12.476624651238847]], "type": "LineString" } }""" self.verifyJson(s, ans) return
def test_write_reproject(self): # tests whether coordinates are correctly reprojected to WGS84 lon/lat p = Line([(1e6, 1e6), (1.2e6, 1.4e6)], crs=WebMercator) s = p.as_geojson() ans = """{ "type": "Feature", "properties": {}, "geometry": { "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "coordinates": [[8.983152841195214, 8.946573850543412], [10.779783409434257, 12.476624651238847]], "type": "LineString" } }""" self.verifyJson(s, ans) return