Esempio n. 1
0
 def test_get_map(self):
     portal = Portal('http://localhost:8090/iportal', 'admin', 'Supermap123')
     portal._portal = mock.MagicMock()
     m = ViewerMap()
     maps_service = mock.MagicMock()
     maps_service.get_map = mock.MagicMock(return_value=m)
     portal._portal.maps_service = mock.MagicMock(return_value=maps_service)
     result = portal.get_map('map_id')
     self.assertEqual(result, m)
Esempio n. 2
0
def from_geodataframe_to_map(portal: Portal, gdf: GeoDataFrame, data_name: str, map_title: str, layer_name: str):
    progress = IntProgress()
    progress.max = 100
    progress.value = 0
    progress.description = '上传文件:'
    display(progress)

    def refresh_progress(read, total):
        progress.value = read

    data_id = portal.upload_dataframe_as_json(data_name, gdf, callback=refresh_progress)
    layer = portal.prepare_geojson_layer(data_id, layer_name)
    map_id = portal.create_map([layer], 3857, map_title)
    mr = portal.get_map(map_id)
    pm = PortalThumbnail(mr)
    display(pm)
    return map_id