如何用PHP调用google 地图 api ?并且将数据库里经纬度表示的点显示在map上?
怎么用PHP调用google map api ?并且将数据库里经纬度表示的点显示在地图上??
如题。最好写详细点,谢谢!
------解决方案--------------------
当中 23.1150614,113.4082905 为位置的经纬度。
<br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><meta http-equiv="X-UA-Compatible" content="IE=7" /><br /><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><br /><meta name="description" content=" " /><br /><title>谷歌地图 api测试</title><br /><style><br />.map {<br /><br />width: 205px;<br />height: 192px;<br />text-align: center;<br />margin: 0 auto;<br /><br />}<br /></style><br /></head><br /><body> <br /><div id="res_map" class="map"></div><br /><script src="http://ditu.google.cn/maps?file=api&v=2&&key=ABQIAAAAHDyarwhqc8qoi6Hi4Fw2ABS7hG4ulivpH-Zy5ZAv91XflKVwfhRT3BrS_8CE9kMWp7UXsEngXSYF3A" type="text/javascript" charset="utf-8"></script> <br /><script type="text/javascript" charset="utf-8"> <br />function show_small_map() <br />{ <br />if (GBrowserIsCompatible()) <br />{ <br />var map = new GMap2(document.getElementById("res_map"));<br />function createMarker(latlng) <br />{<br /> var marker = new GMarker(latlng);<br /> return marker;<br />}<br />map.setCenter(new GLatLng(23.1150614,113.4082905), 16);<br />var smc = new GSmallZoomControl3D;<br />map.addControl(smc);<br />var latlng = new GLatLng(23.1150614,113.4082905);<br />map.addOverlay(createMarker(latlng)); <br /> <br />} <br />}<br />show_small_map();<br /></script><br /></body><br /></html>
这个key 要到谷歌上申请
key=ABQIAAAAHDyarwhqc8qoi6Hi4Fw2ABS7hG4ulivpH-Zy5ZAv91XflKVwfhRT3BrS_8CE9kMWp7UXsEngXSYF3A
本地测试不用key
------解决方案--------------------
读数据库 需要懂动态语言基础
------解决方案--------------------
其实最好的办法是从数据库里读出数据,写入一个外部的KML文件里,再用JS载入。
这东西不是三言两语说的清的,代码什么的,最好自己研究,关键是要真正理解。
参考 https://developers.google.com/maps/documentation/javascript/layers
------解决方案--------------------
demo: http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/ggeoxml_loader.html
kml: http://kml.lover.googlepages.com/my-vacation-photos.kml
源码自己研究去吧。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Many users will choose the Huawei brand when choosing smart watches. Among them, Huawei GT3pro and GT4 are very popular choices. Many users are curious about the difference between Huawei GT3pro and GT4. Let’s introduce the two to you. . What are the differences between Huawei GT3pro and GT4? 1. Appearance GT4: 46mm and 41mm, the material is glass mirror + stainless steel body + high-resolution fiber back shell. GT3pro: 46.6mm and 42.9mm, the material is sapphire glass + titanium body/ceramic body + ceramic back shell 2. Healthy GT4: Using the latest Huawei Truseen5.5+ algorithm, the results will be more accurate. GT3pro: Added ECG electrocardiogram and blood vessel and safety

Screen brightness is an integral part of using modern computing devices, especially when you look at the screen for long periods of time. It helps you reduce eye strain, improve legibility, and view content easily and efficiently. However, depending on your settings, it can sometimes be difficult to manage brightness, especially on Windows 11 with the new UI changes. If you're having trouble adjusting brightness, here are all the ways to manage brightness on Windows 11. How to Change Brightness on Windows 11 [10 Ways Explained] Single monitor users can use the following methods to adjust brightness on Windows 11. This includes desktop systems using a single monitor as well as laptops. let's start. Method 1: Use the Action Center The Action Center is accessible

In iOS 17, Apple introduced several new privacy and security features to its mobile operating system, one of which is the ability to require two-step authentication for private browsing tabs in Safari. Here's how it works and how to turn it off. On an iPhone or iPad running iOS 17 or iPadOS 17, Apple's browser now requires Face ID/Touch ID authentication or a passcode if you have any Private Browsing tab open in Safari and then exit the session or app to access them again. In other words, if someone gets their hands on your iPhone or iPad while it's unlocked, they still won't be able to view your privacy without knowing your passcode

The famous activation script MAS2.2 version supports digital activation again. The method originated from @asdcorp and the team. The MAS author calls it HWID2. Download gatherosstate.exe (not original, modified) from https://github.com/massgravel/Microsoft-Activation-Scripts, run it with parameters, and generate GenuineTicket.xml. First take a look at the original method: gatherosstate.exePfn=xxxxxxx;DownlevelGenuineState=1 and then compare with the latest method: gatheros

Understand the meaning of HTTP 301 status code: common application scenarios of web page redirection. With the rapid development of the Internet, people's requirements for web page interaction are becoming higher and higher. In the field of web design, web page redirection is a common and important technology, implemented through the HTTP 301 status code. This article will explore the meaning of HTTP 301 status code and common application scenarios in web page redirection. HTTP301 status code refers to permanent redirect (PermanentRedirect). When the server receives the client's

You can easily cancel AppleOne (like AppleOne) subscriptions, as well as third-party AppStore subscriptions, on your iPhone, iPad, or Mac. Apple offers a variety of services that Apple device owners can subscribe to, including AppleMusic, AppleTV+, AppleArcade, iCloud+, AppleNews+, and AppleFitness+. It also offers these services as a bundled subscription called Apple One. Apple in March 2023 made significant price increases for several of its services, including Apple TV+, Apple Arcade and

Solution: 1. Check the Content-Type in the request header; 2. Check the data format in the request body; 3. Use the appropriate encoding format; 4. Use the appropriate request method; 5. Check the server-side support.

The latest feature update for Windows 11 is here, and it brings various app updates and improvements, however, many people are reporting that Windows 1123H2 does not have Copilot. This is unfortunate, especially if you're looking forward to trying out new AI assistants. We at Windows Report have encountered the same problem, and in today's guide we will show you some potential solutions that may help if Windows 11 Copilot is missing. How to enable Copilot on 23H2? How do we test, review and score? Over the past 6 months, we have been working hard to establish a new review system for how we produce content. use it
