Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to pass QGeoCodeReply to a map and display the location?
Qt 6.11 is out! See what's new in the release blog

How to pass QGeoCodeReply to a map and display the location?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 1.5k Views 1 Watching
  • 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.
  • W Offline
    W Offline
    WhatIf
    wrote on last edited by
    #1

    Hi,

    I have been trying to write a program to mark a few locations on a map. After several attempts I was able to get the following code together by following the instructions on this page:

    http://doc.qt.io/qt-5/location-maps-cpp.html

            QGeoServiceProvider *provider = new QGeoServiceProvider("Open Street Map");
            QGeoCodingManager *manager = provider->geocodingManager();
    
            QGeoAddress address;         
            QString country = "United States";
            address.setCountry(country);
            QString countryCode = "+1";
            address.setCountryCode(countryCode);
            QString zipCode ="90095";
            address.setPostalCode(zipCode);
            QString state = "California";
            address.setState(state);
            QString street = "405 Hilgard Avenue";
            address.setStreet(street);
    
            QGeoShape shape; 
            shape.CircleType;
    
            QGeoCodeReply *reply = manager->geocode(address, shape);
    

    How do I use the QGeoCodeReply to mark the location on the map?

    And how do I load the map?

    ? 1 Reply Last reply
    0
    • W WhatIf

      Hi,

      I have been trying to write a program to mark a few locations on a map. After several attempts I was able to get the following code together by following the instructions on this page:

      http://doc.qt.io/qt-5/location-maps-cpp.html

              QGeoServiceProvider *provider = new QGeoServiceProvider("Open Street Map");
              QGeoCodingManager *manager = provider->geocodingManager();
      
              QGeoAddress address;         
              QString country = "United States";
              address.setCountry(country);
              QString countryCode = "+1";
              address.setCountryCode(countryCode);
              QString zipCode ="90095";
              address.setPostalCode(zipCode);
              QString state = "California";
              address.setState(state);
              QString street = "405 Hilgard Avenue";
              address.setStreet(street);
      
              QGeoShape shape; 
              shape.CircleType;
      
              QGeoCodeReply *reply = manager->geocode(address, shape);
      

      How do I use the QGeoCodeReply to mark the location on the map?

      And how do I load the map?

      ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      @WhatIf The link you provided already has the answer:

      Currently it is not possible to interact with maps via C++. Mapping applications must use the Maps and Navigation (QML) API.

      1 Reply Last reply
      1
      • W Offline
        W Offline
        WhatIf
        wrote on last edited by
        #3

        oh, no......I missed that line was concentrating on the code.

        Alright, are you familiar with any QML examples/tutorials that can mark several locations on the map. I wish there was a way to do it in C++. I was hoping to skip learning a new language.

        ? L V 3 Replies Last reply
        0
        • W WhatIf

          oh, no......I missed that line was concentrating on the code.

          Alright, are you familiar with any QML examples/tutorials that can mark several locations on the map. I wish there was a way to do it in C++. I was hoping to skip learning a new language.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @WhatIf http://doc.qt.io/qt-5/qtlocation-places-map-example.html

          1 Reply Last reply
          0
          • W WhatIf

            oh, no......I missed that line was concentrating on the code.

            Alright, are you familiar with any QML examples/tutorials that can mark several locations on the map. I wish there was a way to do it in C++. I was hoping to skip learning a new language.

            L Offline
            L Offline
            ldanzinger
            wrote on last edited by
            #5

            @WhatIf You can do this with the ArcGIS SDK all in C++. Here is a sample for geocoding in C++ - https://developers.arcgis.com/qt/cpp/sample-code/geocode_sample.htm

            1 Reply Last reply
            0
            • W WhatIf

              oh, no......I missed that line was concentrating on the code.

              Alright, are you familiar with any QML examples/tutorials that can mark several locations on the map. I wish there was a way to do it in C++. I was hoping to skip learning a new language.

              V Offline
              V Offline
              vladstelmahovsky
              wrote on last edited by
              #6

              @WhatIf you have to use MapQuickItem {} from QML

              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