将数据lat / lng从google maps api保存到db?

时间:2013-09-11 09:47:17

标签: c# javascript asp.net google-maps google-maps-api-3

我正在使用asp.net c#和google maps api。我希望用户可以在地图上设置路线或标记,我可以保存sql中的点以便再次显示它们。

@Chad Killingsworth写了一些代码用于路由,但是如何捕获lat / lng并写入db? polyline snap to road using google maps api v3 http://people.missouristate.edu/chadkillingsworth/mapsexamples/snaptoroad.htm

或者这就是我想要的但是在php中,我怎么能用asp.net做到这一点?我如何知道积分并记录db?

http://vikku.info/programming/google-maps-v3/draggable-directions/saving-draggable-directions-saving-waypoints-google-directions-google-maps-v3.htm

1 个答案:

答案 0 :(得分:0)

你可以像这样获取值,然后保存值。

google.maps.event.addListener(地图,“点击”,功能(事件){

                var p = new google.maps.LatLng(event.latLng.lat(), event.latLng.lng());
                marker.setPosition(p);
                p.lng();
                p.lat();   

                });