{"id":14764,"library":"nominatim","title":"Nominatim OSM API Module (Legacy)","description":"This Python library, version 0.1, is an unmaintained client module for accessing an OpenStreetMap Nominatim API. Released in 2014, it is designed for Python 2.7. For current Nominatim web service access, `geopy` is recommended. For direct access to a local Nominatim database, the actively maintained `nominatim-api` and `nominatim-db` packages should be used.","status":"abandoned","version":"0.1","language":"en","source_language":"en","source_url":"https://github.com/damianbraun/nominatim","tags":["geocoding","openstreetmap","nominatim","python2","abandoned","legacy"],"install":[{"cmd":"pip install nominatim","lang":"bash","label":"Install (Python 2.7 only)"}],"dependencies":[{"reason":"Required for JSON parsing, as specified in the original setup.py for Python 2.7.","package":"simplejson","optional":false}],"imports":[{"note":"The 'nominatim' package is distinct from 'geopy' which is a modern geocoding library including Nominatim support. The legacy 'nominatim' package is for a self-hosted or local Nominatim instance, not the official public API via geopy.","wrong":"from geopy.geocoders import Nominatim","symbol":"ReverseGeocoder","correct":"from nominatim import ReverseGeocoder"}],"quickstart":{"code":"import os\nfrom nominatim import ReverseGeocoder\n\n# This legacy library is designed to connect to a self-hosted Nominatim instance.\n# The URL would point to your local Nominatim reverse.php endpoint.\n# For public Nominatim API, use the 'geopy' library instead.\n\n# Example for a local/self-hosted Nominatim (requires a running Nominatim PHP frontend)\n# Note: This code uses Python 2.7 print syntax and assumes a local Nominatim setup.\n# To run on modern Python, this example would need significant modification.\n\ntry:\n    # Assuming a local Nominatim installation available at this URL\n    # The actual URL might vary based on your Nominatim server setup.\n    # This is illustrative for the *original* library's intended use.\n    nominatim_url = os.environ.get('NOMINATIM_LOCAL_URL', 'http://127.0.0.1/nominatim/reverse.php?format=json')\n    client = ReverseGeocoder(nominatim_url)\n    \n    # Example coordinates (Melbourne, Australia)\n    latitude = -37.856206\n    longitude = 145.233980\n    \n    print(f\"Attempting to reverse geocode {latitude}, {longitude} using legacy nominatim library...\")\n    response = client.geocode(latitude, longitude)\n\n    if response and 'full_address' in response:\n        print(f\"Full Address: {response['full_address']}\")\n    elif response:\n        print(f\"Raw response (no 'full_address'): {response}\")\n    else:\n        print(\"No response or error from Nominatim.\")\n\nexcept ImportError:\n    print(\"Error: The 'nominatim' library is not installed or requires Python 2.7.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n\n# For modern Python and public Nominatim API, consider geopy:\n# from geopy.geocoders import Nominatim\n# geolocator = Nominatim(user_agent=\"my-app-name\")\n# location = geolocator.reverse(\"52.509669, 13.376294\")\n# print(location.address)","lang":"python","description":"This quickstart demonstrates how to use the legacy `nominatim` library to perform reverse geocoding against a *local or self-hosted* Nominatim instance. It highlights the `ReverseGeocoder` class and its `geocode` method. Due to the library's age, the example uses Python 2.7 print syntax and explicitly warns that for modern applications, especially those using the public Nominatim API, `geopy` is the recommended alternative."},"warnings":[{"fix":"Use a Python 2.7 environment or migrate to modern alternatives like `geopy` (for public Nominatim API) or `nominatim-api` (for local Nominatim database access).","message":"This library is designed for Python 2.7. Using it with Python 3 will result in `ImportError` or `SyntaxError` due to incompatible language features (e.g., `print` statement vs. function, module structure).","severity":"breaking","affected_versions":"All versions (0.1) on Python 3.x"},{"fix":"Avoid using this library for new projects. For web service interaction, use `geopy`. For local Nominatim database interaction, use `nominatim-api` and `nominatim-db`.","message":"The `nominatim` package (v0.1) has not been updated since 2014 and is considered abandoned. It targets a potentially outdated Nominatim API endpoint (PHP frontend) and is not compatible with current Nominatim server versions without significant modification.","severity":"deprecated","affected_versions":"0.1"},{"fix":"Carefully review your project requirements. If you need to query the public Nominatim service, use `geopy`. If you need to build and query a local Nominatim database, refer to `nominatim-api` and `nominatim-db` documentation.","message":"This library is distinct from the current official Nominatim Python frontend packages (`nominatim-api`, `nominatim-db`) and `geopy`. It is *not* for querying `nominatim.openstreetmap.org` directly, but rather for a self-hosted instance.","severity":"gotcha","affected_versions":"All versions (0.1)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Ensure you are using a Python 2.7 environment for installation and execution. For modern Python, consider `pip install geopy` and use its Nominatim geocoder instead.","cause":"Attempting to install or import 'nominatim' on a system where pip is linked to Python 3, or the package cannot be found due to being very old/unmaintained.","error":"ImportError: No module named nominatim"},{"fix":"Execute the code in a Python 2.7 interpreter. Alternatively, rewrite the code to conform to Python 3 syntax (`print(response)`), though other incompatibilities may still arise.","cause":"Running Python 2.7 code (e.g., `print response`) in a Python 3 environment. The legacy `nominatim` library uses Python 2.7 syntax.","error":"TypeError: 'str' object is not callable (related to print statement)"},{"fix":"Verify the reachability and configuration of your self-hosted Nominatim server. For public Nominatim services, switch to a modern library like `geopy` which handles network requests and SSL more robustly. Ensure your `user_agent` is set correctly and observe usage policies if using public APIs.","cause":"The legacy library might have issues with modern SSL certificates, network configurations, or the target Nominatim server (if self-hosted) is not responding or configured correctly.","error":"HTTPSConnectionPool(host='your_nominatim_host', port=443): Max retries exceeded with url: ... (Caused by ReadTimeoutError(\"...\"))"}],"ecosystem":"pypi"}