|
1 |
| -# geocodefarm-py |
2 |
| -Python3 Library for Geocode.Farm API |
| 1 | +# GeocodeFarm Python Client |
| 2 | + |
| 3 | +A lightweight, dependency-free Python client for the [Geocode.Farm](https://www.geocode.farm/) API (v4). |
| 4 | +Supports both forward and reverse geocoding with simple, structured results. |
| 5 | + |
| 6 | +> ⚡ No third-party dependencies |
| 7 | +> 🌍 Supports Geocode.Farm v4 |
| 8 | +> 🧵 Easy to use and extend |
| 9 | +
|
| 10 | +--- |
| 11 | + |
| 12 | +## 🔧 Installation |
| 13 | + |
| 14 | +```bash |
| 15 | +pip install geocodefarm |
| 16 | +``` |
| 17 | + |
| 18 | +Or clone from GitHub: |
| 19 | + |
| 20 | +```bash |
| 21 | +git clone https://github.com/geocodefarm/geocodefarm-py.git |
| 22 | +cd geocodefarm-py |
| 23 | +pip install . |
| 24 | +``` |
| 25 | + |
| 26 | +--- |
| 27 | + |
| 28 | +## 🗺️ Usage |
| 29 | + |
| 30 | +```python |
| 31 | +from geocodefarm import GeocodeFarmClient |
| 32 | + |
| 33 | +client = GeocodeFarmClient("your_api_key_here") |
| 34 | + |
| 35 | +# Forward geocoding (address -> lat/lon) |
| 36 | +result = client.forward("1600 Amphitheatre Parkway, Mountain View, CA") |
| 37 | +print(result) |
| 38 | + |
| 39 | +# Reverse geocoding (lat/lon -> address) |
| 40 | +reverse = client.reverse(37.4221, -122.0841) |
| 41 | +print(reverse) |
| 42 | +``` |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## 📦 Response Format |
| 47 | + |
| 48 | +All responses are normalized into this format: |
| 49 | + |
| 50 | +```python |
| 51 | +{ |
| 52 | + "success": True, |
| 53 | + "status_code": 200, |
| 54 | + "lat": 37.4221, |
| 55 | + "lon": -122.0841, |
| 56 | + "accuracy": "ROOFTOP", |
| 57 | + "full_address": "1600 Amphitheatre Parkway, Mountain View, CA 94043, USA", |
| 58 | + "result": { |
| 59 | + "house_number": "1600", |
| 60 | + "street_name": "Amphitheatre Parkway", |
| 61 | + "locality": "Mountain View", |
| 62 | + "admin_2": "Santa Clara County", |
| 63 | + "admin_1": "California", |
| 64 | + "country": "United States", |
| 65 | + "postal_code": "94043", |
| 66 | + "formatted_address": "...", |
| 67 | + "latitude": ..., |
| 68 | + "longitude": ... |
| 69 | + } |
| 70 | +} |
| 71 | +``` |
| 72 | + |
| 73 | +If the request fails, `success` will be `False`, and an `error` message will be included. |
| 74 | + |
| 75 | +--- |
| 76 | + |
| 77 | +## 🛠️ Requirements |
| 78 | + |
| 79 | +- Python 3.7+ |
| 80 | +- No external dependencies |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +## 🪪 License |
| 85 | + |
| 86 | +This project is released under [The Unlicense](https://unlicense.org) — public domain dedication. |
| 87 | + |
| 88 | +--- |
| 89 | + |
| 90 | +## 🌐 Links |
| 91 | + |
| 92 | +- [Geocode.Farm API Documentation](https://www.geocode.farm/our-apis/) |
| 93 | +- [GitHub Repository](https://github.com/geocodefarm/geocodefarm-py) |
| 94 | +- [PyPI Package](https://pypi.org/project/geocodefarm/) |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## 🤝 Contributing |
| 99 | + |
| 100 | +Pull requests are welcome. If you find bugs or want to improve the client, feel free to open an issue or PR. |
0 commit comments