コード例 #1
0
from mapview import MapView, MapMarker
from mapview.geojson import GeoJsonMapLayer
from mapview.clustered_marker_layer import ClusteredMarkerLayer
from mapview.utils import haversine, get_zoom_for_radius

source = sys.argv[1]

options = {}
layer = GeoJsonMapLayer(source=source)

# try to auto center the map on the source
lon, lat = layer.center
options["lon"] = lon
options["lat"] = lat
min_lon, max_lon, min_lat, max_lat = layer.bounds
radius = haversine(min_lon, min_lat, max_lon, max_lat)
zoom = get_zoom_for_radius(radius, lat)
options["zoom"] = zoom

view = MapView(**options)
view.add_layer(layer)

marker_layer = ClusteredMarkerLayer(
    cluster_radius=200
)
view.add_layer(marker_layer)

# create marker if they exists
count = 0

コード例 #2
0
from mapview import MapView, MapMarker
from mapview.geojson import GeoJsonMapLayer
from mapview.clustered_marker_layer import ClusteredMarkerLayer
from mapview.utils import haversine, get_zoom_for_radius

source = sys.argv[1]

options = {}
layer = GeoJsonMapLayer(source=source)

# try to auto center the map on the source
lon, lat = layer.center
options["lon"] = lon
options["lat"] = lat
min_lon, max_lon, min_lat, max_lat = layer.bounds
radius = haversine(min_lon, min_lat, max_lon, max_lat)
zoom = get_zoom_for_radius(radius)
options["zoom"] = zoom

view = MapView(**options)
view.add_layer(layer)

marker_layer = ClusteredMarkerLayer(
    cluster_radius=200
)
view.add_layer(marker_layer)

# create marker if they exists
count = 0