This is an Android application built with Qt 6.6 and QML that maps Iranian vehicle license plate codes to their corresponding cities or towns, displaying the location on an interactive OpenStreetMap (OSM). Users can input a two-digit plate code and a Persian letter to view the associated city/town and its location marked on the map.
- License Plate to City Mapping: Enter a two-digit code (e.g., "72") and a Persian letter (e.g., "ج") to identify the city/town (e.g., "بابل").
- Comprehensive Coverage: Includes mappings for all Iranian provinces and approximately 300 cities/towns, sourced from reliable references like hamrah-mechanic.com.
- Interactive Map: Displays the city/town location on an OSM map with a red circle marker.
- Touch Gestures: Supports pinch-to-zoom and panning on Android for intuitive map navigation.
- No API Key Required: Uses the OSM plugin, which requires no API key, with local tile caching for improved performance.
- Persian UI: Fully supports Persian text input and display with RTL layout, using the Tahoma font.
- Error Handling: Validates inputs and provides feedback for invalid plate codes or letters.
- Qt 6.6: Ensure Qt 6.6 is installed with the following modules:
Qt6::QuickQt6::LocationQt6::Positioning
- Android SDK/NDK: Required for building and deploying to Android devices.
- Qt Creator: Recommended IDE for building and debugging.
- Internet Connection: Initial map tile download requires internet access (cached locally afterward).
-
Clone the Repository:
git clone https://github.com/your-username/iran-vehicle-map.git cd iran-vehicle-map -
Set Up Qt Environment:
- Install Qt 6.6 via the Qt Maintenance Tool.
- Ensure
Qt6::Quick,Qt6::Location, andQt6::Positioningmodules are included. - Configure Android SDK/NDK in Qt Creator (Tools > Options > Devices > Android).
-
Project Configuration:
- Open the project in Qt Creator by loading
CMakeLists.txtorvehiclemap.pro. - Verify the project includes:
or
find_package(Qt6 6.6 REQUIRED COMPONENTS Quick Location Positioning) target_link_libraries(appVehicleMap PRIVATE Qt6::Quick Qt6::Location Qt6::Positioning)
QT += quick location positioning
- Open the project in Qt Creator by loading
-
Build and Deploy:
- Select an Android device or emulator in Qt Creator.
- Build and run the project (Ctrl+R or Run button).
- Ensure the device has internet access for initial OSM tile download.
- Launch the App:
- The app opens with a Persian interface titled "نقشه شهر و شهرستان خودروهای ایران بر اساس کد و حرف پلاک".
- Enter License Plate Details:
- Vehicle Number (Optional): Enter the full plate number (e.g., "123456").
- Plate Code: Enter a two-digit code (e.g., "72").
- Plate Letter: Enter a single Persian letter (e.g., "ج").
- View Results:
- Click "پیدا کردن شهر/شهرستان و نمایش روی نقشه".
- The app displays the city/town (e.g., "شهر/شهرستان: بابل") and centers the map on its coordinates (e.g., Babol: 36.5514, 52.6791) with a red circle marker.
- Invalid inputs show "ورودی نامعتبر" or "نامشخص (کد پلاک نامعتبر)".
- Interact with the Map:
- Pinch to zoom in/out.
- Drag to pan the map.
- Input: Code = "72", Letter = "ج"
- Output: "شهر/شهرستان: بابل", map zooms to Babol with a red marker.
- Invalid Input: Code = "99", Letter = "ز" → "شهر/شهرستان: نامشخص (کد پلاک نامعتبر)".
- Map Doesn’t Load:
- Ensure internet connectivity for initial OSM tile download.
- Check Qt Creator’s console for "Map plugin loaded: osm" and "Supported map types".
- Verify the
mapcachedirectory is writable. - Try removing
PluginParameterlines inmain.qml:plugin: Plugin { name: "osm" }
- Marker Doesn’t Appear:
- Check console for "Error: MapCircle does not have 'center' property".
- Uncomment the
MapQuickItemsection inmain.qmlas a fallback and update the button’sonClickedto usemarkerCircle.coordinate = coord.
- Touch Gestures Fail:
- Test on a physical Android device (emulators may have touch limitations).
- Verify
PinchAreaandMouseAreaare handling events (addconsole.login their handlers if needed).
- QQmlApplicationEngine Errors:
- Ensure
Qt6::LocationandQt6::Positioningmodules are installed (Qt Maintenance Tool). - Check Qt Creator’s Application Output for detailed errors and share them for support.
- Ensure
- Persian Text Issues:
- Use a Persian keyboard on Android for RTL input.
- Ensure the Tahoma font is available or replace with another Persian-compatible font (e.g., "Vazir").
main.qml: Main QML file with the UI, map, and license plate logic.qml.qrc: Resource file for QML assets (addcar.pngfor custom markers if needed).CMakeLists.txtorvehiclemap.pro: Build configuration for Qt 6.6 and Android.
- The app includes mappings for ~300 Iranian cities/towns, covering all provinces (e.g., Mazandaran: "72ج" → "بابل", Tehran: "11ب" → "تهران").
- Data is sourced from reliable references like hamrah-mechanic.com and coordinates from SimpleMaps or latlong.net.
- The full mapping is available in
main.qml(abbreviated for brevity). Contact the repository owner for a complete JSON file.
- Add a custom vehicle icon using
MapQuickItemand acar.pngimage. - Implement full offline map support by downloading OSM tiles and configuring a local tile provider.
- Expand the UI with search history or favorite locations.
- Add support for other vehicle plate types (e.g., commercial, government).
Contributions are welcome! To contribute:
- Fork the repository.
- Create a branch (
git checkout -b feature/your-feature). - Commit changes (
git commit -m "Add your feature"). - Push to the branch (
git push origin feature/your-feature). - Open a pull request.
Please include tests and update documentation for new features.
This project is licensed under the MIT License. See the LICENSE file for details.
For issues, feature requests, or questions, open an issue on GitHub or contact the repository owner.