-
Notifications
You must be signed in to change notification settings - Fork 215
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
REF: Remove network kwarg from Proj and Transformer #708
Conversation
Question: do you then need to enable the network before creating the transformer object to have effect? Or can you switch back and forth for a single transformer object? |
Yes, you need to enable it before creating the transformer. It wouldn't be a good idea to allow toggling the network after it is enabled as it impacts how it is initialized. |
Ref: #629 (comment) |
d8b9b46
to
6d2010e
Compare
Did some tests with the global context to see what the behavior changes would be with toggling the network on the context of a transformer and it seems like it doesn't change results when toggling after initialization. Base script: import logging
import pyproj
from pyproj import Transformer
logging.basicConfig(format="%(levelname)s:%(message)s", level=logging.DEBUG)
pyproj.set_use_global_context(True)
lonlat = -74.9, 39.9
pyproj.network.set_network_enabled(True)
tr = Transformer.from_crs("epsg:4326", "esri:102003", always_xy=True)
albers_pt = tr.transform(*lonlat, errcheck=True)
print(f"Albers: {albers_pt}")
print(tr.is_network_enabled)
pyproj.network.set_network_enabled(False)
albers_pt = tr.transform(*lonlat, errcheck=True)
print(f"Albers: {albers_pt}")
print(tr.is_network_enabled) Initialized enabled. enable result == disable result:
Initialized disabled. disable result == enable result:
|
This was originally added in #637. Since then, #675 and #695 were added. With those additions, I think it make sense to remove the
network
kwarg because: