WorldWideScripts.net Delivering the best Add-Ons in more than 37 languages.

中文(简体), English, हिन्दी/हिंदी, Español/Castellano, العربية, Русский язык, Français, 中文 (台灣), বাংলা, Bahasa Indonesia, اردو, Português, Deutsch, Bahasa Melayu (بهاس ملايو‎), 日本語 (にほんご), فارسی, Italiano, తెలుగు, Türkçe, ગુજરાતી, Język polski/polszczyzna, Tiếng Việt, ಕನ್ನಡ, Українська мова, ไทย
PHP Scripts / Miscellaneous

PHP Map + Location Plugin

— Add-On to WorldWideScripts.net

Subscribe to our feed to stay up to date!

New! Follow us as you want it!


PHP Map + Location Plugin - CodeCanyon Item for Sale

Ads

Ad: Bluehost hosting

This is a collection of location based functions that can get a users location based on their ip address using the IPInfoDB api, return advanced details on a specific location with the Yahoo PlaceFinder api, or dynamically create maps (as images or with javascript) using the Google Maps api.

IP Location

This function interacts with the IPInfoDB.com API to get a users location based on their IP address. It can return city, state, country, latitude & longitude and is accurate within a 25 mile radius. This function accepts an IP Address and returns an array of location based values.

 $location = $location->ip ($_SERVER['REMOTE_ADDR']); // Values returned $location['country']; $location['country_code']; $location['state']; $location['city']; $location['post_code']; $location['latitude']; $location['longitude']; 
Your IP Based Location
Country: United States
Country Code: US
State: Washington
City: Kirkland
Post Code:
Latitude: 47.6966
Longitude: -122.197


On the map

See below on how to generate maps

Place Finder

This function uses the Yahoo PlaceFinder API to get detailed information about a specific location. This is the way to go if you want to get more detailed information or find a more exact location. It accepts a textual location (zip code, city/state, street address, latitude/longitude, etc) and returns an array of location based values.

 $info = $location->info ('400 Broad St Seattle, WA 98109'); // Values returned $info['country']; $info['country_code']; $info['state']; $info['state_code']; $info['county']; $info['city']; $info['post_code']; $info['cross_street']; $info['house']; $info['street']; $info['radius']; $info['quality']; $info['woeid']; $info['latitude']; $info['longitude']; 

Country: United States
Country Code: US
State: Washington
State Code: WA
County: King County
City: Seattle
Post Code: 98109
Cross Street: Near the intersection of Broad St and John St
House: 400
Street: Broad St
Radius: 500
Quality: 87
Where on Earth ID: 12798953
Latitude: 47.619859
Longitude: -122.348749

Google Maps

Use this to automatically generate Google Maps for a specific location. This function accepts a number of parameters:

  • 1. location (required. options: latitude and longitude)
  • 2. format (options: javascript, jpg, jpg-baseline, png, png32, gif))
  • 3. map type (options: roadmap, hybrid, satellite, terrain)
  • 4. width (options: value in px or %)
  • 5. height (options: value in px or %)
  • 6. zoom level (options: number between 1 and 21)
  • 7. id (options: any valid css id)


Example 1 (Javascript)

The first example uses javascript to generate a dynamic map. To generate a map with javascript you’ll need to pass both the latitude and longitude coordinates to the location parameter (the latidude and longitude can be retreived with either the ip location or place finder functions descriped above). The map is injected into a div with an id of “map_canvas” by default (whose height/width can be modified via css). If you want to set the width & height with css instead of via the function, pass “css” to both the width and height parameters.

 $coordinates = $info['latitude'].','.$info['longitude']; echo $location->map($coordinates, 'javascript', 'hybrid', '100%', '300px', '16', 'map_1'); 
Results…

Google Maps (Image)

Currently the map function in only able to add one javascript map per page. If you need multiple maps (or just want to generate an image instead) simply set the second parameter to the type of image you want returned (jpg, jpg-baseline, png, png32 or gif). You can set the dimensions to anything you like, but Google’s maximum allowed image size is 630 by 630 pixels. A few examples of different image settings follow…

 echo $location->map($coordinates, 'png32', 'roadmap', '630px', '630px', '11', 'map_2'); 

 echo $location->map($coordinates, 'jpg', 'satellite', '630px', '200px', '7', 'map_3'); 

 echo $location->map($coordinates, 'gif', 'terrain', '200px', '200px', '5', 'map_4'); 

 echo $location->map($coordinates, 'png', 'satellite', '630px', '200px', '1', 'map_5'); 

More Files From the PHP Plugin Suite

Bitly

Image Plugin

Twitter Plugin

Video Plugin

Weather Plugin


pose css


Download
Other components in this categoryAll components of this author
CommentsFrequently asked questions and answers

Properties

Created:
30 January 11

Last Update:
N/A

High Resolution:
No

Compatible Browsers:
IE6, IE7, IE8, Safari, Opera

Files Included:
PHP

Software Framework:
CodeIgniter

Software Version:
PHP 5.x, PHP 5.0 - 5.2, PHP 5.3

Keywords

eCommerce, eCommerce, All Items, codeigniter, google, ip location, maps, php, yahoo