GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — mapview/examples/clustered_geojson.py at develop · dengbolin1/mapview Expand file tree/ Copy pathclustered_geojson.pyMore file actions 48 lines (35 loc) · 1.14 KB / Copy pathclustered_geojson.pyFile metadata and controls48 lines (35 loc) · 1.14 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 import sys from kivy.base import runTouchApp from kivy_garden.mapview import MapMarker, MapView from kivy_garden.mapview.clustered_marker_layer import ClusteredMarkerLayer from kivy_garden.mapview.geojson import GeoJsonMapLayer from kivy_garden.mapview.utils import get_zoom_for_radius, haversine 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 def create_marker(feature): global count geometry = feature["geometry"] if geometry["type"] != "Point": return lon, lat = geometry["coordinates"] marker_layer.add_marker(lon, lat) count += 1 layer.traverse_feature(create_marker) if count: print("Loaded {} markers".format(count)) runTouchApp(view) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |