Skip to content

dateline issue/horizontal lines #1

@barronh

Description

@barronh

A common problem is where lines cross the domain. This happens when a polygons crosses the datelien and therefore is on both side of the polygon.

Usually, this can be handled by adding xlim/ylim parameters to cno as shown below. This limits the polygons to those within a specific clipping area. The clipping area is set to larger than the plotting area to ensure that the boundaries cover the plot from edge to edge. This is unnecessary when the polygon (e.g., country) of interest is within the plot.

Basic setup

import matplotlib.pyplot as plt
import pyproj
import pycno

proj = pyproj.Proj('+proj=lcc +lat_0=-20.251 +lon_0=-40.285 +lat_1=-24.25 +lat_2=-16.25 +x_0=80000 +y_0=83000 +R=6370000 +units=km +no_defs', preserve_units=True)

With the problem

cno = pycno.cno(proj=proj)
cno.draw('MWDB_Coasts_Countries_1.cnob')
plt.xlim(0, 160)
plt.ylim(0, 160)

Fixes problem

cno = pycno.cno(proj=proj, xlim=(-50, 180), ylim=(-50, 180))
cno.draw('MWDB_Coasts_Countries_1.cnob')
plt.xlim(0, 160)
plt.ylim(0, 160)

Even though this issue is easily solved, it would be nice to not have to worry about it.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions