javascript - Leaflet Draw Plugin:: how to find latlng of polyline and save them to Database -
i have fetched latlng of polyline using function getlatlngs(). latlng saved in database in format "latlng(-37.76949, 175.26481),latlng(-37.77211, 175.26884),latlng(-37.77323, 175.26532)".
$query = "select * geofence geo_type=3"; $result = pg_exec($db_handle,$query); if($result) { for($row = 0; $row < pg_numrows($result); $row++){ $fence_id = pg_result($result,$row,'geo_id'); $fence_nam = strtoupper(pg_result($result,$row,'geo_name')); $fence_typ = pg_result($result,$row,'geo_type'); $fence_coord = pg_result($result,$row,'geo_coord'); ?> line<? echo $fence_id; ?> = new l.polyline([new l.<? echo $fence_coord ?>).addto(map); <? } } ?> } how draw these latlng on map? have used php split method split latlngs no success.
i used javascript function function splitfunc(str){ var = ""+str; var b= replaceall(/\)\,/g,":",a); var c= replaceall(/latlng\(/g," ",b); var d= replaceall(/\)/g," ",c); return d; } function replaceall(find, replace, str) { return str.replace(find, replace); } using these functions can save lat long in format
Comments
Post a Comment