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

后端 未结 9 746
天命终不由人
天命终不由人 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:54

    I was having the same problem, the fact is that the input of lat and long should be String. Only then did I manage.

    for example:

    Controller.

     ViewBag.Lat = object.Lat.ToString().Replace(",", ".");
    
     ViewBag.Lng = object.Lng.ToString().Replace(",", ".");
    

    View - function javascript

    
    

    I convert the double value to string and do a Replace in the ',' to '.' And so everything works normally.

提交回复
热议问题