Geographic Information from National ID
ThegetPlaceByIranNationalId utility extracts the birthplace (city and province) information encoded in Iranian National ID numbers.
Basic Usage
Simple Extraction
How It Works
Iranian National IDs encode geographic information in their first 3 digits, which correspond to the registration office where the ID was issued (typically the birthplace).🗺️ Geographic Encoding
🗺️ Geographic Encoding
The first 3 digits represent a unique code for each registration office across Iran’s provinces and cities.
📊 Coverage
📊 Coverage
Supports all 31 provinces and hundreds of cities across Iran with their registration office codes.
🔍 Validation
🔍 Validation
Only works with valid National IDs - invalid IDs return null.
Advanced Examples
User Registration with Location
Demographics Analysis
Geographic Filtering
Major Cities and Codes
- Tehran Province
- Isfahan Province
- Fars Province
- Khuzestan Province
| Code Range | City |
|---|---|
| 001-085 | تهران |
| 136-151 | ورامین |
| 196-200 | پاکدشت |
| 219-229 | اسلامشهر |
| 297-300 | شهریار |
Return Value Structure
Edge Cases
Invalid National IDs
Unknown Geographic Codes
Different Input Formats
Performance Considerations
🚀 Performance Metrics
🚀 Performance Metrics
- Lookup time: ~0.02ms (hash table lookup)
- Memory overhead: ~50KB (geographic database)
- Batch processing: Excellent scaling
📊 Optimization Tips
📊 Optimization Tips
- Cache results for repeated lookups
- Validate National ID first to avoid unnecessary lookups
- Use in combination with validation for better UX
