Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Displaying a high number of qmlMapItems on map with Mapbox plugin
Forum Updated to NodeBB v4.3 + New Features

Displaying a high number of qmlMapItems on map with Mapbox plugin

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 187 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    piotrklima
    wrote on last edited by
    #1

    Hello everyone,
    I am trying to create display a large number (around 2000) of points on qml Map with mapbox plugin. The point positions should be updated regulary and I have the performance problem with very high amount of points but the problem isnt with updates but with points creation itself.

    Is it possible to have some many qmlMapItems on Map at the same time?

     Map {
              objectName: "Map"
              id:map
              anchors.fill: parent
              plugin: mapboxglPlugin
              center: QtPositioning.coordinate(30.0, 30.0) 
              zoomLevel: 14
              Component.onCompleted: {
                  MyScript.createPoints();
                }
    }
    
    function createPoints() {
        component = Qt.createComponent("mapCircle.qml");
        if (component.status === Component.Ready){
            finishCreation();
        }
        else
            component.statusChanged.connect(finishCreation);
    }
    
    function finishCreation() {
        if (component.status === Component.Ready) {
            for(var i = 0;i < 2000;i++){
                mcircle = component.createObject(map,{objectName:"MapCircle"+i});
                map.addMapItem(mcircle);
    
            }
    
            if (mcircle === null) {
                // Error Handling
                console.log("Error creating object");
            }
        } else if (component.status === Component.Error) {
            // Error Handling
            console.log("Error loading component:", component.errorString());
        }
    
    MapCircle{
        objectName:"MapCircle"
        id:circle
        radius: 50.0;
        color: "red"
        border.width:  3.0
        center{
            latitude: 30.0
            longitude: 30.0
        }
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved