本文目錄一覽:
PHP百度地圖API怎麼讀取資料庫里的坐標點顯示在地
用ajax···資料庫查詢好數據後以json的格式和js通信··然後顯示在頁面上··PHP百度地圖API怎麼讀取資料庫里的坐標點顯示在地
thinkphp怎麼引入百度地圖
百度地圖api結合jquery ajax提交終於弄好了
function getStore(obj){
for (var i = 0; i obj.length; i ++) {
var p0 = obj[i].point.split(“,”)[0];
var p1 = obj[i].point.split(“,”)[1];
var points = new BMap.Point(p0,p1);
var sContent = ” + ”+obj[i].store_name+”+ ‘
‘ + ‘地址:’+obj[i].address+’
電話:’+obj[i].store_tel+’
簡介:’+obj[i].about+’
‘ + ‘店鋪星級:
去逛逛’+ ”;
var cate=obj[i].category;
var icon = new BMap.Icon(‘__PUBLIC__/Img/point.png’, new BMap.Size(30, 45), {
infoWindowAnchor: new BMap.Size(10, 0)//設置標註圖片
});
addMarker(points,sContent,icon);
}
}
//上面是通過json交互過來的數據處理把店鋪坐標和相關的信息標註到頁面
$(function(){
window.onload = function() {
$.get(‘__URL__/searchStore’,function(json){
getStore(json);
});
}
$(“.wstore”).click(function(){
map.clearOverlays();//清楚全部重新載入
var c=$(this).attr(‘val’);
$.get(‘__URL__/searchStore’,{c:c},function(json){
getStore(json);
});
})
$(“#submit”).click(function(){
map.clearOverlays();
//搜索店鋪
$.post(‘__URL__/searchStore’,{name:$(“#search”).val()},function(json){
getStore(json);
});
})
})
如何用PHP獲取百度地圖
這個直接看百度地圖的api啊···其實html就可以了···php只是用來記錄坐標什麼的有用·給你個例子吧·
!DOCTYPE html
html
head
meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /
style type=”text/css”
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;}
/style
script type=”text/javascript” src=”;ak=您的密鑰”/script
title百度地圖的Hello, World/title
/head
body
div id=”allmap”/div
/body
/html
script type=”text/javascript”
var map = new BMap.Map(“allmap”); // 創建Map實例
var point = new BMap.Point(116.404, 39.915); // 創建點坐標
map.centerAndZoom(point,15); // 初始化地圖,設置中心點坐標和地圖級別。
map.enableScrollWheelZoom(); //啟用滾輪放大縮小
/script
這都是百度地圖上的····自己去研究一下吧··
原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/192622.html