Phpgoogleapi interface program

Source: Internet
Author: User
Common google map development parameters phproogle: apiKey. this is Google's user API key. you can also set a new instance to be constructed using instancated. phproogle: addGoogl... common google map development parameters

Phproogle: apiKey

. This is Google's user API key. you can also set a new instance to be constructed using instancated.

Phproogle: addGoogleMapControl ()

This method can be set, for example, the zoom control controller's Google map or map control. this method can be called multiple times to set multiple map controls. Options are:

* GLargeMapControl

* GSmallMapControl

* GSmallZoomControl

* GScaleControl

* GMapTypeControl

* GHierarchicalMapTypeControl

* GOverviewMapControl

AddGoogleMapControl ("GSmallMapControl");?>

Phproogle: mapType

This sets the map type to one of the four options: This sets one of the four map type options:

* Normal

* Satellite

* Hybrid

* Physical physics

MapType = "normal";?>

Phproogle: mapCenter

T this will set the map center within the partition range. this value is the order of the map center containing the latitude and longitude.

$ Map-> mapCenter = array (-33.862828, 151.216974); 1 $ map-> mapCenter = array (-33.862828, 151.216974); 1

Phproogle: mapZoom

This sets the map zoom level. The zero value is the widest scaling level and displays the whole world. Although the 19th is the highest zoom, the building will be displayed. Each zoom level doubles the zoom. zoom twice for Each zoom level. 12. the default value is 12.

Phproogle: addMarker ()

This function is used to create and place markers upon the map. This function is used to mark the map after creation and location. The addMarker method takes three args. There are three methods in addMarker argS.

* Float $ latitude floating $ latitude

* Float $ longpolling floating $ longitude

* String $ html string $ HTML

. Longitude and latitude are both numeric values and HTML can be any HTML or text that will be placed in the markup balloon.

Phproogle: addMarkerAddress ()

This method is similar to phproogle: addMarker () and place mark on the map. However, instead of accepting the longitude and latitude to place the flag, this method requires two values.

* String $ address

* String $ html string $ HTML

The address of the parameter, for example, "simple address from Second Street to Paris, France ". Balloon. in the HTML parameter again, any text or HTML is placed in the information balloon.

Phproogle: mapDivID

When set, this will set the group ID ING to live in the default value of "map"

Phproogle: mapWidth

As the name suggests, this will set the p width of the map to live in the default width of 350 pixels.

Phproogle: mapHeight

This sets the height of the partition. the default value of the map is 300 pixels.

Phproogle: googleJS ()

The JavaScript string returned by this method is used in the file header to display the string most frequently connected to the Google API key.

Phproogle: drawMap ()

The JavaScript map itself returned by this method.

 ApiKey = is_null ($ apiKey )? '': $ ApiKey;/*** set the map types ***/$ this-> setGoogleMapTypes ();} /*** @ setter ** @ access public **/public function _ set ($ name, $ value) {switch ($ name) {case 'apikey ': if (! Is_string ($ value) {throw new Exception ($ name, $ value, 'string') ;}$ this-> $ name = $ value; break; case 'mapzoom ': if (filter_var ($ value, FILTER_VALIDATE_INT, array ("options" => array ("min_range" => 0, "max_range" => 19) = false) {throw new Exception ("$ name is out of range") ;}$ this-> $ name = $ value; break; case 'mapwidth': if (filter_var ($ value, FILTER_VALIDATE_INT, array ("options" => ar Ray ("min_range" => 100, "max_range" => 900) = false) {throw new Exception ("$ name is out of range ");} $ this-> $ name = $ value; break; case 'mapheight': if (filter_var ($ value, FILTER_VALIDATE_INT, array ("options" => array ("min_range" => 100, "max_range" => 900) = false) {throw new Exception ("$ name is out of range for") ;}$ this-> $ name = $ value; break; case 'maptype': if (! Array_key_exists ($ value, $ this-> googleMapTypes) {throw new Exception ("$ name is not a valid map type") ;}$ this-> $ name = $ value; break; case 'mapdivid': if (! Is_string ($ value) {throw new Exception ("$ name is not a valid") ;}$ this-> $ name = $ value; break; case 'mapcenter ': if (! Is_array ($ value) {throw new Exception ("$ name is not a valid array");} $ this-> $ name = $ value; break; default: throw new Exception ("Invalid Parameter $ name");}/*** @ getter ** @ access public **/public function _ get ($ name) {switch ($ name) {case 'apikey': return $ this-> apiKey; break; case 'mapzoom ': return $ this-> mapZoom; break; case 'mapwidth ': return $ this-> mapWidth; break; case 'mapheight': return $ this-> mapHeight; break; case 'maptype': return $ this-> mapType; break; case 'mapdidid': return $ this-> mapDivID; break; case 'mapcenter'; return $ this-> mapCenter; break;}/*** if we are here, throw an invalid ton ***/throw new Exception ("$ name is invalid ");} /*** @ isset *** @ access public **/public function _ isset ($ name) {switch ($ name) {case 'apikey ': $ this-> apiKey = $ name; break; case 'mapzoom ': $ this-> mapZoom = $ name; break; case 'mapwidth ': $ this-> mapWidth = $ name; break; case 'mapheight': $ this-> mapHeight = $ name; break; case 'maptype ': $ this-> mapType = $ name; break; case 'mapdidid': $ this-> mapDivID = $ name; break; case 'mapcenter '; $ this-> mapCenter = $ name; break; default: return false ;}} /*** @ Set the map types *** @ access private ** @ return void **/private function setGoogleMapTypes () {$ this-> googleMapTypes = array ('Physical '=> 'G _ PHYSICAL_MAP', 'normal' => 'G _ NORMAL_MAP ', 'samples' => 'G _ SATELLITE_MAP ', 'hybrid' => 'G _ HYBRID_MAP ');} /*** @ add to the array of google maps controls *** @ access public ** @ return void **/public function addGoogleMapControl ($ control) {$ n = sizeof ($ this-> googleMapControls); $ this-> googleMapControls [] = $ control ;} /*** @ get pinpoint marker by address ** @ access public ** @ param string $ address ** @ param string $ html ** @ return void **/public function addMarkerAddress ($ address, $ html) {$ s = sizeof ($ this-> markerAddresses); $ this-> markerAddresses [$ s] ['address'] = $ address; $ this-> markerAddresses [$ s] ['html'] = $ html ;} /*** @ get pinpoint mark by latitude or longpolling *** @ access public ** @ param string $ lat ** @ param string $ long ** @ param string $ html ** @ return void **/public function addMarker ($ lat, $ long, $ html) {$ pointer = sizeof ($ this-> markerPoints); $ this-> markerPoints [$ pointer] ['lat'] = $ lat; $ this-> markerPoints [$ pointer] ['long'] = $ long; $ this-> markerPoints [$ pointer] ['HTML '] = $ html ;} /*** @ The javascript for google to connect *** @ access public *** @ return string **/public function googleJS () {return'

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.