fix weird coastlines

they were getting Zed by fuse_russia.
This commit is contained in:
Justin Kunimune 2024-01-08 22:02:03 -05:00
parent 990205bec6
commit b417e0ba18
7 changed files with 63 additions and 61 deletions

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 27 MiB

After

Width:  |  Height:  |  Size: 27 MiB

View File

@ -23,7 +23,7 @@ def main():
' </clipPath>\n'
' <g clip-path="url(#clipPath)">\n'
' <g class="land">\n'
+ plot_shapes('ne_50m_land', trim_antarctica=True, mark_antarctica=True) +
+ plot_shapes('ne_50m_land', trim_antarctica=True, mark_antarctica=True, fuse_russia=True) +
' </g>\n'
' <g class="water">\n'
+ plot_shapes('ne_50m_lakes', max_rank=4) +
@ -266,7 +266,7 @@ def main():
+ plot_shapes('ne_10m_admin_0_boundary_lines_disputed_areas') +
' </g>\n'
' <g class="coastline">\n'
+ plot_shapes('ne_10m_coastline', trim_antarctica=True, fuse_russia=True) +
+ plot_shapes('ne_10m_coastline', trim_antarctica=True) +
' </g>\n'
' <g class="lake">\n'
+ plot_shapes('ne_10m_lakes', max_rank=4) +

View File

@ -11,7 +11,7 @@ def plot_indicatrix(phi0, lam0, r, res) -> str:
points = []
for l in range(0, 360, 360//res):
points.append(obliquify(math.pi/2-r, math.radians(l), phi0, lam0))
return plot(points)
return plot(points, close=True)
def plot_side_indicatrix(phi0, r, res, side_res=1) -> str:
@ -28,7 +28,7 @@ def plot_side_indicatrix(phi0, r, res, side_res=1) -> str:
points.append((pr, lr + math.pi))
for i in range(side_res):
points.append((phi0-r+(2*r)/side_res*(i+1), math.pi))
return plot(points, midx=midx, close=False)
return plot(points, midx=midx)
def plot_pole_indicatrix(north, r, res, ctr_meridian=0., side_res=1, pole_res=1) -> str:
@ -46,7 +46,7 @@ def plot_pole_indicatrix(north, r, res, ctr_meridian=0., side_res=1, pole_res=1)
points.append((pr + (pp-pr)/side_res*(i+1), ctr_meridian+math.pi))
for x in range(180, -181, -360//pole_res):
points.append((pp, ctr_meridian+math.radians(x)))
return plot(points)
return plot(points, close=True)
def generate_indicatrices(spacing, radius, adjust_poles=False, resolution=60, ctr_meridian=0, side_res=1, pole_res=1) -> str:

View File

@ -11,7 +11,7 @@ def plot_orthodrome(phi0, lam0, tht0) -> str:
points = []
for p in np.linspace(-90, 90, 1001):
points.append(obliquify(radians(p), tht0, phi0, lam0))
return plot(points, close=False)
return plot(points)
def generate_orthodromes() -> str:

View File

@ -226,7 +226,7 @@ def plot_political_shapes(data: dict[str, tuple[Shape, Optional[dict[str, Any]],
# the normal polygon
if mode == "normal":
if has_geometry:
result += plot(shape.points, midx=shape.parts, close=False,
result += plot(shape.points, midx=shape.parts,
fourmat='xd', tabs=num_tabs + 1, ident=identifier)
any_content = True
# or the clipped and copied thick border

View File

@ -38,7 +38,7 @@ def plot_shapes(
if fuse_russia:
shape.points, shape.parts = fuse_edges(shape.points, shape.parts)
result += plot(shape.points, midx=shape.parts, close=False,
result += plot(shape.points, midx=shape.parts,
clazz=clazz_for_this_section, fourmat='xd')
return result

View File

@ -3,7 +3,9 @@ from __future__ import annotations
import random as rng
from typing import Any, Iterable, Optional
import numpy as np
import shapefile
from matplotlib import pyplot as plt
from numpy import pi, sin, cos, tan, arcsin, arccos, degrees, ceil, radians, arctan2, hypot, cumsum
from shapefile import NULL, Shape, ShapefileException
@ -74,7 +76,7 @@ def obliquify(lat1, lon1, lat0, lon0):
return latf, lonf
def plot(coords: list[tuple[float, float]], midx: Optional[list[int]] = None, close=True, fourmat='pr', clazz=None, ident=None, tabs=4) -> str:
def plot(coords: list[tuple[float, float]], midx: Optional[list[int]] = None, close=False, fourmat='pr', clazz=None, ident=None, tabs=4) -> str:
"""
express a list of 2D points as an SVG <path> tag
:param coords: the coordinate pairs of the vertices