-1

I have a VERY LONG script including the function "ox.distance.get_nearest_edge". When I run it under my local computer with osmnx version 1.1.1, I get a warning that the function is deprecated and may be removed in a future release. I now need to let the script run on a server, I installed osmnx, but the script does'nt work anymore even though I installed the same version (1.1.1). (I also took care that python, geopandas, networkx etc were the same).

The error message I get is "AttributeError: 'osmnx.distance' has no attribute 'get_nearest_edge'"

(I tried to use the new function from osmnx instead (ox.distance.nearest_edges), but it seems to work very differently, and I run into errors trying to adapt my (long) script correcly).

Make old functions work would be a good way to keep old scripts working. But why is the funktion not becoming available again when I install the old osmnx-package with all of its dependencies? Do I have to install even older package versions of osmnx? I use anaconda package controlling, and JupyterLab to run my script (just in case that is a relevant detail).

PinkyBrain
  • 19
  • 5

1 Answers1

1

Re-verify the version you're running in your script. The get_nearest_nodes and get_nearest_edges functions were deprecated in v1.1 but not removed until the release of v1.2. If you do want to use a newer version, you can take advantage of the much faster and more flexible nearest_nodes and nearest_edges functions that replaced them. See the docs and usage examples for details and demonstrations.

gboeing
  • 5,691
  • 2
  • 15
  • 41
  • Thank you very much for your attempt to help!!! The program version of osmnx I doubble-checked. It is, after a downgrade attempt, now even at v1.1.0 on the server where the script is supposed to run. I never had the latest version 1.2.1 installed on the server! I'm getting desperate because I now know for sure, thanks to your confirmation, that the get_nearest_edge function should keep working in 1.1.1. – PinkyBrain Aug 09 '22 at 21:43