Skip to content

hasa1368/Vehicle_Number

Repository files navigation

Iran Vehicle License Plate Map

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.

Features

  • 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.

Prerequisites

  • Qt 6.6: Ensure Qt 6.6 is installed with the following modules:
    • Qt6::Quick
    • Qt6::Location
    • Qt6::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).

Installation

  1. Clone the Repository:

    git clone https://github.com/your-username/iran-vehicle-map.git
    cd iran-vehicle-map
  2. Set Up Qt Environment:

    • Install Qt 6.6 via the Qt Maintenance Tool.
    • Ensure Qt6::Quick, Qt6::Location, and Qt6::Positioning modules are included.
    • Configure Android SDK/NDK in Qt Creator (Tools > Options > Devices > Android).
  3. Project Configuration:

    • Open the project in Qt Creator by loading CMakeLists.txt or vehiclemap.pro.
    • Verify the project includes:
      find_package(Qt6 6.6 REQUIRED COMPONENTS Quick Location Positioning)
      target_link_libraries(appVehicleMap PRIVATE Qt6::Quick Qt6::Location Qt6::Positioning)
      or
      QT += quick location positioning
  4. 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.

Usage

  1. Launch the App:
    • The app opens with a Persian interface titled "نقشه شهر و شهرستان خودروهای ایران بر اساس کد و حرف پلاک".
  2. 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., "ج").
  3. 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 "نامشخص (کد پلاک نامعتبر)".
  4. Interact with the Map:
    • Pinch to zoom in/out.
    • Drag to pan the map.

Example

  • Input: Code = "72", Letter = "ج"
  • Output: "شهر/شهرستان: بابل", map zooms to Babol with a red marker.
  • Invalid Input: Code = "99", Letter = "ز" → "شهر/شهرستان: نامشخص (کد پلاک نامعتبر)".

Troubleshooting

  • 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 mapcache directory is writable.
    • Try removing PluginParameter lines in main.qml:
      plugin: Plugin { name: "osm" }
  • Marker Doesn’t Appear:
    • Check console for "Error: MapCircle does not have 'center' property".
    • Uncomment the MapQuickItem section in main.qml as a fallback and update the button’s onClicked to use markerCircle.coordinate = coord.
  • Touch Gestures Fail:
    • Test on a physical Android device (emulators may have touch limitations).
    • Verify PinchArea and MouseArea are handling events (add console.log in their handlers if needed).
  • QQmlApplicationEngine Errors:
    • Ensure Qt6::Location and Qt6::Positioning modules are installed (Qt Maintenance Tool).
    • Check Qt Creator’s Application Output for detailed errors and share them for support.
  • 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").

Project Structure

  • main.qml: Main QML file with the UI, map, and license plate logic.
  • qml.qrc: Resource file for QML assets (add car.png for custom markers if needed).
  • CMakeLists.txt or vehiclemap.pro: Build configuration for Qt 6.6 and Android.

City/Town Mapping

  • 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.

Future Improvements

  • Add a custom vehicle icon using MapQuickItem and a car.png image.
  • 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).

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a branch (git checkout -b feature/your-feature).
  3. Commit changes (git commit -m "Add your feature").
  4. Push to the branch (git push origin feature/your-feature).
  5. Open a pull request.

Please include tests and update documentation for new features.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For issues, feature requests, or questions, open an issue on GitHub or contact the repository owner.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published