omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Unable to use location.reverse_geocode inside a scene/layer

    Pythonista
    5
    27
    13698
    Loading More Posts
    • 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.
    • daveM
      daveM last edited by

      Yeah, I’m really not sure what’s happening. I don’t really get it. If you try the code at the very top, it should work as expected and GeoCode and ReverseGeo both work (probably not on your iPad, did you try the working code on your phone?

      I only dig up this old thread because the problem seemed to be identical and was hopeful that one of the original posters might remember how (if) they resolved it

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @daveM last edited by

        @daveM Just try working code on my iPad and ok (gps known via WiFi router even if no iPad cellular)

        1 Reply Last reply Reply Quote 0
        • daveM
          daveM @cvp last edited by

          @cvp

          Ahh found the issue. I didn’t look hard enough. There was another post detailing the answer and it has worked. Placing the first line here before the update gets things working!!

          @ui.in_background
          def update(self):
              If not...
          

          https://forum.omz-software.com/topic/5430/reverse-geolocation-works-on-console-but-not-in-code/5

          cvp 1 Reply Last reply Reply Quote 0
          • cvp
            cvp @daveM last edited by cvp

            @daveM well done
            the worst is that I knew it, I had read this topic, but I forgot, sad to grow old 👴🏻😢

            Only 3 months later, shame on me

            1 Reply Last reply Reply Quote 0
            • daveM
              daveM last edited by

              Lol. Yes. I saw your name there. All good. I’m not sure how much older than me you might be, but I certainly understand the pains of a failing memory!!! Lol

              cvp 3 Replies Last reply Reply Quote 0
              • cvp
                cvp @daveM last edited by

                @daveM I never say my age but if you tap on @cvp you will see it 😂

                1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @daveM last edited by

                  @daveM Also, be careful, these geocode functions need an Internet connection and if you call them to often, you could be refused during some time...

                  1 Reply Last reply Reply Quote 0
                  • cvp
                    cvp @daveM last edited by cvp

                    @daveM see Apple doc

                    you should not send more than one geocoding request per minute

                    Édit: typed before reading your post just under

                    daveM 1 Reply Last reply Reply Quote 0
                    • daveM
                      daveM last edited by

                      Rofl re not speaking your age. Lol. I’ve just hit a milestone that involved the words [‘half’,’century’], but as with most people I know, now it is just a number. Nobody really cares (unless you’re looking for work or a partner!!!) lol

                      Re the geocode API, I’ve been wondering what the “go” is with it. I have been using the google API for a few years and never had any issues. But I’ve always respected the limits and played by the rules. I was surprised Apple has opened them up to third parties. I’ll dig through the Apple docs later and see what restrictions are in place, but I don’t plan to use it too often. I’m developing an in-house tool that will allow using it as required. But it’ll only be 10-20 times a day. Although I may hit limits in testing. I hope that’s not the case. Lol

                      1 Reply Last reply Reply Quote 0
                      • daveM
                        daveM @cvp last edited by

                        @cvp you beat me to it! Thanks very much I do appreciate that! Cheers!!

                        (Damn, if someone could hit me some rep points I’d appreciate it!!! @cvp and I submitted a message about the same time, I can’t respond until the time passes... which is why I added this text to the bottom!!) lol

                        cvp 1 Reply Last reply Reply Quote 1
                        • cvp
                          cvp @daveM last edited by cvp

                          @daveM see this script

                          I localize my contacts on a map using this CLGeocoder and I have more than 200 contacts. The script has to retry a lot because it is too much requests in some seconds.

                          On GitHub, this explanation of my code:

                          sometimes, geocodeAddressString returns None. Either the address string is invalid, but somerimes, a retry gives a correct gps localization. Perhaps due to a big number of calls in a short time. In this case, the script display a button 'nn not (yet) localized' and starts a thread which will retry (maximum 100 times) all not yet localized contacts. The delay between two retries increase at each retry. The button title is green if the thread runs and red if not. Tapping this button gives the list of these contacts with their retries number

                          1 Reply Last reply Reply Quote 0
                          • daveM
                            daveM last edited by

                            Nice idea. I do like it. I love that we have such great access to the Apple ecosystem through python. Some of the stuff I’ve seen people put together (yourself included) is encouraging.

                            1 Reply Last reply Reply Quote 0
                            • First post
                              Last post
                            Powered by NodeBB Forums | Contributors