def plot_route_network_thumbnail(g, map_style=None): width = 512 # pixels height = 300 # pixels scale = 24 dpi = mpl.rcParams["figure.dpi"] width_m = width * scale height_m = height * scale median_lat, median_lon = get_median_lat_lon_of_stops(g) dlat = util.wgs84_height(height_m) dlon = util.wgs84_width(width_m, median_lat) spatial_bounds = { "lon_min": median_lon - dlon, "lon_max": median_lon + dlon, "lat_min": median_lat - dlat, "lat_max": median_lat + dlat } fig = plt.figure(figsize=(width / dpi, height / dpi)) ax = fig.add_subplot(111) plt.subplots_adjust(bottom=0.0, left=0.0, right=1.0, top=1.0) return plot_route_network_from_gtfs(g, ax, spatial_bounds, map_alpha=1.0, scalebar=False, legend=False, map_style=map_style)
def test_wgs84_width(self): lat = 60.4192161560059 lon = 25.3302955627441 # Test going 100m east width = util.wgs84_width(100, lat) lon2 = lon + width d = util.wgs84_distance(lat, lon, lat, lon2) self.assertTrue(self._approximately_equal(d, 100)) # Test going 100m south height = util.wgs84_height(100) lat2 = lat + height d = util.wgs84_distance(lat, lon, lat2, lon) self.assertTrue(self._approximately_equal(d, 100))