javascript - setRadius: not a number, Google Maps V3 in MVC 5 -
I am trying to show a map with a circle in a marker and a MVC 5 project. Displays the map with the marker, but the error set radius is found on the circle method: no number.
Code here:
& lt; Script type = "text / javascript" src = "http://maps.google.com/maps/api/js?sensor=false" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; $ (Document) .ready (function () {initialize ();}); Function initialize () {var myLat = '@ Model.Lat'replace (', ','. '). replace the (' ',' '); Var myLong = 'Model' Loan'. (',', '.'). replace the ('', ''); Var rad = '@ Model.Acc'.replace (', ','. '). replace the (' ',' '); Var center = new google.maps.LatLng (myLat, myLong); // LatLng var mapOptions = {center: center, zoom: 16, mapTypeId: google.maps.MapTypeId.ROADMAP} at the center point of the circle; Var map = new google.maps.Map (document.getElementById ("map_canvas"), map options); // Create a marker var marker = new google.maps.marker ({status: center, map: map, title: 'my location'}); Var Option = {Stroke Coiler: '# 0000ff', Stroke Opacity: 1.0, StrokeWeight: 1, Phil Collar: '# 3366ff', Fillopopity: 0.5, Map: Map, Center: Center, Radius: RAD}; Circle = new google.maps.Circle (option); } & Lt; / Script & gt; & Lt; Br / & gt; & Lt; Div id = "map_canvas" style = "width: 100%; height: 480px;" & Gt; & Lt; / Div & gt;
I displayed the variable red with a warning and the value is 10.5, if I set the option radius of 10.5 manually.
What is the problem?
Problem found I
radius: rad
>radius: parseFloat (rad)
Hope helps anyone else.
Comments
Post a Comment