Turn addresses into coordinates and find nearby amenities using Google Maps API
Project description
Mapradar
Mapradar is a location intelligence library that converts addresses to coordinates, finds nearby services (banks, hospitals), and calculates travel distances via Google Maps APIs.
Installation
Primary Method
Python
uv add mapradar
Rust
[dependencies]
mapradar = "0.4.2"
tokio = { version = "1", features = ["full"] }
CLI Tool
cargo install mapradar
From Source
git clone https://github.com/iamprecieee/mapradar
cd mapradar
# Python
uv add maturin
maturin develop
# Rust
cargo build
Usage
CLI Commands
# Geocode an address
mapradar geocode "1600 Amphitheatre Parkway, Mountain View, CA"
# Find nearby amenities
mapradar nearby --lat 6.6018 --lng 3.3515 --radius 500 --type bank,school
# Distance calculation
mapradar distance --origin-addr "Shibuya, Tokyo" --dest-addr "Shinjuku, Tokyo" --mode drive
Library Usage
Python Example
import asyncio
from mapradar import MapradarClient, SearchQuery, ServiceType, TravelParameters
async def main():
client = MapradarClient("YOUR_GOOGLE_MAPS_API_KEY")
# Calculate travel distance between two points
params = TravelParameters(
origin_address="Shibuya, Tokyo",
destination_address="Shinjuku, Tokyo"
)
distance = await client.calculate_travel_distance(params)
print(f"Distance: {distance:.2f} km")
# Find banks and hospitals near an address
query = SearchQuery.from_address("Shibuya, Tokyo")
intel = await client.fetch_intelligence(
query,
service_types=[ServiceType.Bank, ServiceType.Hospital],
radius_km=3.0
)
print(f"Location: {intel.location.address}")
asyncio.run(main())
Rust Example
use mapradar::client::MapradarClient;
use mapradar::models::{SearchQuery, ServiceType};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = MapradarClient::new("YOUR_API_KEY".to_string());
let location = client.geocode_async("Times Square, NYC").await?;
println!("{}, {} ({})", location.latitude, location.longitude, location.country);
Ok(())
}
Features
| Feature | Description |
|---|---|
| Geocoding | Convert addresses to coordinates |
| Reverse Geocoding | Convert coordinates to addresses |
| Nearby Search | Find banks, hospitals, schools, etc. |
| Distance Fetching | Fast travel/Haversine distance with address fallthrough |
| Parallel Fetching | Search multiple service types at once |
| Caching | Automatic in-memory cache reduces API calls |
| JSON-RPC 2.0 | Built-in format for microservice APIs |
Configuration
| Option | Default | Description |
|---|---|---|
GOOGLE_MAPS_API_KEY |
None | Your Google Maps API key. Enable Geocoding API, Places API (New), and Routes API. |
max_results |
20 | Maximum number of places returned per category. |
radius |
5.0 | Search radius in kilometers. |
--mode |
drive |
Transit mode for distance calculation (e.g. drive, okada, auto, ojek, danfo, angkot). |
FAQ
What APIs do I need enabled?
Enable these in Google Cloud Console:
- Geocoding API
- Places API (New)
- Routes API (V2)
Is there rate limiting?
Mapradar does not rate limit locally. Your Google Maps API quota applies. Use the built-in Moka cache to reduce outbound calls.
Does caching persist across restarts?
No. Cache is in-memory only. It persists for the lifetime of your MapradarClient instance to ensure maximum security.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mapradar-0.4.2.tar.gz.
File metadata
- Download URL: mapradar-0.4.2.tar.gz
- Upload date:
- Size: 35.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9af0e1c9aa64133bfcfb30e299374cd74bf141f9223538e51153a28e38a2bf2
|
|
| MD5 |
dd8491fb23b2332af9baacebfeef348d
|
|
| BLAKE2b-256 |
8d0fed409191fd76ccdac0f905b318eaa170b4fd6683de6d63ab23973b4825da
|
File details
Details for the file mapradar-0.4.2-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: mapradar-0.4.2-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 3.1 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2bc39f0a15b3db5c8f17eb446715cf33f42571506c534f2fc7676ded453c6dd1
|
|
| MD5 |
182cdd3a2a383ee8c240adddde927edb
|
|
| BLAKE2b-256 |
dd1773315d84c9c1675234deaca7c7dd01eb96db28f293f11328de4ddbbca8fa
|