r65671 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65670‎ | r65671 | r65672 >
Date:21:46, 29 April 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.6 - Added comma removal upon failiure to the geocoder class
Modified paths:
  • /trunk/extensions/Maps/Geocoders/Maps_Geocoder.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Geocoders/Maps_Geocoder.php
@@ -99,7 +99,15 @@
100100
101101 // Call the geocode function in the spesific geocoder class.
102102 $coordinates = call_user_func( array( $egMapsGeoServices[$service], 'geocode' ), $address );
103 -
 103+
 104+ // If there address could not be geocoded, and contains comma's, try again without the comma's.
 105+ // This is cause several geocoding services such as geonames do not handle comma's well.
 106+ if ( !$coordinates && strpos( $address, ',' ) !== false ) {
 107+ $coordinates = call_user_func(
 108+ array( $egMapsGeoServices[$service], 'geocode' ), str_replace( ',', '', $address )
 109+ );
 110+ }
 111+
104112 // Add the obtained coordinates to the cache when there is a result and the cache is enabled.
105113 if ( $egMapsEnableGeoCache && $coordinates ) {
106114 MapsGeocoder::$mGeocoderCache[$address] = $coordinates;

Status & tagging log