How to fix Uncaught InvalidValueError: setPosition: not a LatLng or LatLngLiteral: in property lat: not a number?

后端 未结 9 735
天命终不由人
天命终不由人 2020-12-13 17:14

I\'m trying to port my googlemaps v2 functions to v3.

But somehow i stuck in a strange error and i could not find, what i\'m doing wrong.

Erro

相关标签:
9条回答
  • 2020-12-13 17:58

    I had the same problem, and resolved it. In my case it was error due to the non-proper format. Please check the first and last coordinates array in geometry coordinates they must be same then and only then it will work. Hope it may help you!

    0 讨论(0)
  • 2020-12-13 18:03

    What about casting to Number in Javascript using the Unary (+) Operator

    lat: 12.23
    
    lat: +12.23
    

    Depends on the use case. Here is a fullchart what works and what not: parseInt vs unary plus - when to use which

    0 讨论(0)
  • 2020-12-13 18:04

    I had the same problem with exactly the same error message. In the end the error was, that I still called the maps v2 javascript. I had to replace:

    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=####################" type="text/javascript"></script>
    

    with

    <script src="http://maps.googleapis.com/maps/api/js?key=####################&sensor=false" type="text/javascript"></script>
    

    after this, it worked fine. took me a while ;-)

    0 讨论(0)
提交回复
热议问题