Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] coord converter efficency improvemet #21

Closed
KipCrossing opened this issue May 5, 2021 · 1 comment
Closed

[Feature] coord converter efficency improvemet #21

KipCrossing opened this issue May 5, 2021 · 1 comment

Comments

@KipCrossing
Copy link
Owner

Adds

        if crs_code == 4326:
            return(xx, yy)

to bypass the transformer and increase conversion efficiency.

    def _convert_to_wgs_84(self, crs_code: int, xxyy: Tuple[float, float]) -> Tuple[float, float]:
        xx: float = xxyy[0]
        yy: float = xxyy[1]
        if crs_code == 4326:
            return(xx, yy)
        crs_4326: CRS = CRS("WGS84")
        crs_proj: CRS = CRS.from_epsg(crs_code)
        transformer: Transformer = Transformer.from_crs(crs_proj, crs_4326, always_xy=True)
        return(transformer.transform(xx, yy))
@KipCrossing
Copy link
Owner Author

KipCrossing commented May 12, 2021

There's a big efficiency improvment by converting entire arrays:

lon_vals, lat_vals = transformer.transform(x_vals, y_vals)

Perhaps a feature could be

.get_x_array()
.get_y_array()

Thats gets the 2d array of the converted coords

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant