mysql-百度地圖從MySql中獲取經(jīng)緯度
來源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-09 16:52:40
mysql-百度地圖從MySql中獲取經(jīng)緯度
mysql-百度地圖從MySql中獲取經(jīng)緯度:mysql百度地圖數(shù)據(jù)庫(kù) String driverName=com.mysql.jdbc.Driver;//驅(qū)動(dòng)程序名String userName=root;//數(shù)據(jù)庫(kù)用戶名String userPasswd=qwe;//密碼String dbName=test;//數(shù)據(jù)庫(kù)名String tableName=loc
導(dǎo)讀mysql-百度地圖從MySql中獲取經(jīng)緯度:mysql百度地圖數(shù)據(jù)庫(kù) String driverName=com.mysql.jdbc.Driver;//驅(qū)動(dòng)程序名String userName=root;//數(shù)據(jù)庫(kù)用戶名String userPasswd=qwe;//密碼String dbName=test;//數(shù)據(jù)庫(kù)名String tableName=loc
mysql百度地圖數(shù)據(jù)庫(kù)
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page language="java" %>
<%@ page import="com.mysql.jdbc.Driver" %>
<%@ page import="java.sql.*" %>
<%
String driverName="com.mysql.jdbc.Driver";//驅(qū)動(dòng)程序名
String userName="root";//數(shù)據(jù)庫(kù)用戶名
String userPasswd="qwe";//密碼
String dbName="test";//數(shù)據(jù)庫(kù)名
String tableName="location";//表名
//聯(lián)結(jié)字符串
String url="jdbc:mysql://localhost/"+dbName+"?user="+userName+"&password="+userPasswd;
Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection=DriverManager.getConnection(url);
Statement statement = connection.createStatement();
String sql="SELECT * FROM "+tableName;
ResultSet rs = statement.executeQuery(sql);
int size = rs.getRow();//數(shù)據(jù)行數(shù)
ResultSetMetaData rmeta = rs.getMetaData();//獲得數(shù)據(jù)結(jié)果集合
int numColumns=rmeta.getColumnCount();//確定數(shù)據(jù)集的列數(shù),亦字段數(shù)
//輸出每一個(gè)數(shù)據(jù)值
out.print(size+" ");
out.print("
");
while(rs.next()) {
out.print(rs.getString(1)+" ");//編號(hào)
out.print("|");
Double point1=rs.getDouble(4);
Double point2=rs.getDouble(3);
out.print(point1+" ");//輸出經(jīng)度
out.print(point2+" ");//輸出緯度
out.print("
");
}
%>
body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;}#l-map{height:100%;width:78%;float:left;border-right:2px solid #bcbcbc;}#r-result{height:100%;width:20%;float:left;}折線var map = new BMap.Map("allmap");var point = new BMap.Point(113.001,28.23540605);var p=document.from1.myhidden.value;map.centerAndZoom(point, 13);var polyline = new BMap.Polyline([ new BMap.Point(113.0051,28.2334), new BMap.Point(113.0031,28.2322), new BMap.Point(113.0041,28.23241)], {strokeColor:"blue", strokeWeight:6, strokeOpacity:0.5});//這里的坐標(biāo)需要從數(shù)據(jù)庫(kù)獲?。?! 卡在這里了map.addOverlay(polyline);
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
mysql-百度地圖從MySql中獲取經(jīng)緯度
mysql-百度地圖從MySql中獲取經(jīng)緯度:mysql百度地圖數(shù)據(jù)庫(kù) String driverName=com.mysql.jdbc.Driver;//驅(qū)動(dòng)程序名String userName=root;//數(shù)據(jù)庫(kù)用戶名String userPasswd=qwe;//密碼String dbName=test;//數(shù)據(jù)庫(kù)名String tableName=loc