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

pyproj warning #855

Closed
jeweinberg opened this issue Dec 7, 2020 · 5 comments
Closed

pyproj warning #855

jeweinberg opened this issue Dec 7, 2020 · 5 comments
Labels

Comments

@jeweinberg
Copy link

looks like pyproj is causing an issue when trying to change projections. When I plot polygons after this error the polygons are broken with points out of order.

data = pd.DataFrame.from_records([
    {'lat': 18.030293, 'lon': -66.594315},
    {'lat': 19.851411, 'lon': -155.089965}
])
sdf = pd.DataFrame.spatial.from_xy(data, 'lat', 'lon')
sdf.spatial.project(102100)

error:

/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  return _prepare_from_string(" ".join(pjargs))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:294: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  projstring = _prepare_from_string(" ".join((projstring, projkwargs)))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  return _prepare_from_string(" ".join(pjargs))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:294: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  projstring = _prepare_from_string(" ".join((projstring, projkwargs)))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  return _prepare_from_string(" ".join(pjargs))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:294: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  projstring = _prepare_from_string(" ".join((projstring, projkwargs)))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:53: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  return _prepare_from_string(" ".join(pjargs))
/home/INTERNAL/h14322/.conda/envs/geo_env/lib/python3.6/site-packages/pyproj/crs/crs.py:294: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
  projstring = _prepare_from_string(" ".join((projstring, projkwargs)))

Platform (please complete the following information):

  • OS: ubuntu
  • Browser chrome
  • Python API Version 1.8.2
@jeweinberg jeweinberg added the bug label Dec 7, 2020
@achapkowski
Copy link
Contributor

achapkowski commented Dec 8, 2020

@jeweinberg

Try this:
sdf = pd.DataFrame.spatial.from_xy(data, 'lat', 'lon', 102100)

Then you do not need to do the project on the SeDF

@jeweinberg
Copy link
Author

jeweinberg commented Dec 8, 2020

Ok, that could get me a solution for now. Will specifying sr in the from_xy method actually re-project the data, or does that just specify what projection the data is already in? The data above is in 4326, and I want to convert it to a different projection.

@achapkowski
Copy link
Contributor

The pyproj messages are not errors, they are warnings, so it is reprojecting the data. pyproj moved from v1 to v2 and on v2 they had breaking changes.

@jeweinberg
Copy link
Author

jeweinberg commented Dec 8, 2020

Yeah, I see that it re-projects but the points of polygons go out of order. I think pyproj has an always_xy flag that needs to be turned to True to fix it.

geopandas fixed it that way. But looks like there is a different method for projection now in pyproj.
geopandas/geopandas#1036

@achapkowski
Copy link
Contributor

@jeweinberg we have put in a fix for the 1.9 release.

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

No branches or pull requests

2 participants