I use the following razor code to generate some javascript to produce markers on a Google map.
@foreach(Point point in Model.Points.Take(3))
{
String longitude = point.Longitude.ToString(CultureInfo.InvariantCulture);
String latitude = point.Latitude.ToString(CultureInfo.InvariantCulture);
<text>
var location = new google.maps.LatLng(@(longitude), @(latitude));
bounds.extend(location);
var marker = new google.maps.Marker({
position: location,
map: map
});
</text>
}
In development, this correctly becomes:
var location = new google.maps.LatLng(52.2124273, 5.9545532);
bounds.extend(location);
var marker = new google.maps.Marker({
position: location,
map: map
});
However, on our production server, it becomes:
var location = new google.maps.LatLng(522124273000, 59545532000);
bounds.extend(location);
var marker = new google.maps.Marker({
position: location,
map: map
});
Which is producing just a grey Google map. What is causing this strange ToString
behavior?
edit
The Point class is a custom class, not from a library. Here are the relevant parts:
public class Point
{
private Double latitude;
private Double longitude;
public Double Latitude
{
get
{
return latitude;
}
}
public Double Longitude
{
get
{
return longitude;
}
}
}