- mapsandsemanticmaps0.2.zip
- Maps
- COPYING
- Geocoders
- GoogleMaps
- INSTALL
- Maps.i18n.php
- Maps.php
- Maps_BaseGeocoder.php
- Maps_BaseMap.php
- Maps_Geocoder.php
- Maps_Mapper.php
- Maps_Settings.php
- Maps_Utils.php
- MapUtilityFunctions.js
- OpenLayers
- Maps_OpenLayers.php
- OpenLayerFunctions.js
- OpenLayers
- img
- blank.gif
- cloud-popup-relative.png
- drag-rectangle-off.png
- drag-rectangle-on.png
- east-mini.png
- layer-switcher-maximize.png
- layer-switcher-minimize.png
- marker.png
- marker-blue.png
- marker-gold.png
- marker-green.png
- measuring-stick-off.png
- measuring-stick-on.png
- north-mini.png
- panning-hand-off.png
- panning-hand-on.png
- slider.png
- south-mini.png
- west-mini.png
- zoombar.png
- zoom-minus-mini.png
- zoom-plus-mini.png
- zoom-world-mini.png
- OpenLayers.js
- theme
- default
- framedCloud.css
- google.css
- ie6-style.css
- img
- add_point_off.png
- add_point_on.png
- blank.gif
- close.gif
- drag-rectangle-off.png
- drag-rectangle-on.png
- draw_line_off.png
- draw_line_on.png
- draw_point_off.png
- draw_point_on.png
- draw_polygon_off.png
- draw_polygon_on.png
- editing_tool_bar.png
- move_feature_off.png
- move_feature_on.png
- navigation_history.png
- overview_replacement.gif
- pan_off.png
- pan_on.png
- panning-hand-off.png
- panning-hand-on.png
- pan-panel.png
- pan-panel-NOALPHA.png
- remove_point_off.png
- remove_point_on.png
- ruler.png
- save_features_off.png
- save_features_on.png
- view_next_off.png
- view_next_on.png
- view_previous_off.png
- view_previous_on.png
- zoom-panel.png
- zoom-panel-NOALPHA.png
- style.css
- OSM
- README
- RELEASE-NOTES
- YahooMaps
- SemanticMaps
|
<?php
/**
* Yahoo! Geocoding Service info: http://developer.yahoo.com/geo/geoplanet/
*
* @file Maps_YahooGeocoder.php
* @ingroup Maps
*
* @author Jeroen De Dauw
*
*/
if( !defined( 'MEDIAWIKI' ) ) {
die( 'Not an entry point.' );
}
final class MapsYahooGeocoder extends MapsBaseGeocoder {
/**
* @see MapsBaseGeocoder::geocode()
*
* @param unknown_type $address
*/
public static function geocode($address) {
global $egYahooMapsKey;
// In case the Yahoo! Maps API key is not set, return false
if (empty($egYahooMapsKey)) return false;
// Create the request url
$requestURL = "http://where.yahooapis.com/v1/places.q('".urlencode($address)."')?appid=".urlencode($egYahooMapsKey)."&format=xml";
if ($handle = fopen($requestURL, "r")) {
$result = fread($handle, 10000);
fclose($handle);
$lon = self::getXmlElementValue($result, "longitude");
$lat = self::getXmlElementValue($result, "latitude");
// In case one of the values is not found, return false
if (!$lon || !$lat) return false;
return array(false, false, $lat, $lon);
}
else { // When the request fails, return false
return false;
}
}
/**
* Gets the contents of the first XML tag with the provided name,
* returns false when no matching element is found.
*
* @param string $xml
* @param string $tagName
* @return unknown
*/
private static function getXmlElementValue($xml, $tagName) {
$match = array();
preg_match("/<$tagName>(.*?)<\/$tagName>/", $xml, $match);
return count($match) > 1 ? $match[1] : false;
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a free and open source software enthusiast and freelance software developer with multiple years of experience in both web and desktop development. Currently my primarily focus is on MediaWiki and Semantic MediaWiki work. I'm in the all time top 10 MediaWiki comitters and am one of the WikiWorks consultants. You can contact me at jeroendedauw at gmail for development jobs and questions related to my work.
More info can be found on my website [0] and my blog [1]. You can also follow me on twitter [2] and identi.ca [3].
[0] http://www.jeroendedauw.com/
[1] http://blog.bn2vs.com/
[2] https://twitter.com/#!/JeroenDeDauw
[3] http://identi.ca/jeroendedauw