Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How used apiKey in OSM Plugin?
Forum Updated to NodeBB v4.3 + New Features

How used apiKey in OSM Plugin?

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
3 Posts 3 Posters 930 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.
  • M Offline
    M Offline
    Mikeeeeee
    wrote on last edited by
    #1

    Hi!
    How used apiKey in OSM Plugin?
    This my code:

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtLocation 5.12
    import QtPositioning 5.12
    
    Item {
        visible: true
        width: 480
        height: 720
    
        property double old : 19
        property double now
    
        Rectangle
        {
            anchors.fill: parent
            color: "#eee"
    
            Plugin
            {
                id: plugin
                name: "osm"
                PluginParameter { name: "osm.useragent"; value: "My great Qt OSM application" }
            }
    
            Map
            {
                id: maps
                anchors.fill: parent
                plugin: plugin
                gesture.enabled: true
                gesture.acceptedGestures: MapGestureArea.PinchGesture | MapGestureArea.PanGesture | MapGestureArea.FlickGesture
                gesture.flickDeceleration: 3000
                zoomLevel: 19
                center: QtPositioning.coordinate(55.845741, 37.660652) // Moscow
                copyrightsVisible: false 
                activeMapType: maps.supportedMapTypes[5] 
                //activeMapType: SatelliteMapNight
                //activeMapType: PedestrianMap
                //activeMapType: MapType.SatelliteMapNight
                //activeMapType: MapType.PedestrianMap
    
    
                onCenterChanged:
                {
                    if (zoomLevel >= 17.5) 
                    {
    
    
                    }
                }
    
                minimumZoomLevel: 1
    
                focus: true
    
                PlaceSearchModel {
                    id: mySearchModel
                    plugin: plugin
                    searchArea: visibleRegion.boundingGeoRectangle()
                    onSearchAreaChanged:  //it's work
                    {
                        console.log("onSearchAreaChanged :" )
                        console.log("count :" + mySearchModel.count)
                        if (count == 1) {
    
                        }
    
                    }
                }
    
                GeocodeModel {           //Location get(index) должно возвращать координаты
                    id: geocodeModel
                    plugin: plugin
                    onLocationsChanged:
                    {
                        //console.log("count: " + geocodeModel.count)
                        //console.log("bounds: " + geocodeModel.bounds)
                        console.log("onLocationsChanged")
                        if (count == 1) {
    
                            console.log("text:" + geocodeModel.get(0).address.text )
                            console.log("coordinate:" + geocodeModel.get(0).coordinate)
                        }
                    }
                }
            }
        }
    }
    
    1 Reply Last reply
    0
    • MikeSheldonM Offline
      MikeSheldonM Offline
      MikeSheldon
      wrote on last edited by
      #2

      Hi,

      I realise this topic is a bit old but I've just run into this same issue myself, and have discovered a solution for it. So for the sake of anyone else coming across this on Google the mechanism I discovered for providing an API key to the OSM plugin is to set up your own providers repository, that way you can specify the API key as part of the URL template.

      I made a simple github repo with a script for creating a repository here: https://github.com/Elleo/qt-osm-map-providers

      And I wrote up a more detailed explanation of everything on my blog here: https://blog.mikeasoft.com/2020/06/22/qt-qml-maps-using-the-osm-plugin-with-api-keys/

      Hope that helps,
      Mike

      D 1 Reply Last reply
      0
      • MikeSheldonM MikeSheldon

        Hi,

        I realise this topic is a bit old but I've just run into this same issue myself, and have discovered a solution for it. So for the sake of anyone else coming across this on Google the mechanism I discovered for providing an API key to the OSM plugin is to set up your own providers repository, that way you can specify the API key as part of the URL template.

        I made a simple github repo with a script for creating a repository here: https://github.com/Elleo/qt-osm-map-providers

        And I wrote up a more detailed explanation of everything on my blog here: https://blog.mikeasoft.com/2020/06/22/qt-qml-maps-using-the-osm-plugin-with-api-keys/

        Hope that helps,
        Mike

        D Offline
        D Offline
        dama
        wrote on last edited by
        #3

        @MikeSheldon Hi. I tried to follow your instructions with my own api key, but did not succeed in removing the watermark. How did you retrieve the original setup files from the Tunderforest server?

        --
        Dag Magne

        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