Turns a postal code into a latitude/longitude coordinate.

@param string|integer $postal_code

@return LatLon
482852
public function geocode( $postal_code ) {
    // Validate ZIP code.
    if ( false == static::validate_postal_code( $postal_code ) ) {
      throw new GeocodingException( 'ZIP code value is invalid: ' . $postal_code );
    }

    // Delegate geocoding to underlying provider.
    return $this->getGeocodingProvider()->geocode( $postal_code );
  }
693060
public function geoCoder($lat, $lng, $ak, $mcode, $url)
    {
        $client = new \GuzzleHttp\Client();

        $parameters = [
            'form_params' => [
                'ak'       => $ak,
                'location' => $lat . ',' . $lng,
                'output'   => 'json',
                'pois'     => 0,
                'mcode'    => $mcode,
            ],
        ];

        $geo_coder = $client->request('POST', $url, $parameters);
        $geo_coder = json_decode($geo_coder->getBody());

        return $geo_coder;
    }
1292273
public function setBillingAdress(
        $postalCode,
        $street = null,
        $number = null,
        $complement = null,
        $district = null,
        $city = null,
        $state = null,
        $country = null
    ) {

        $param = $postalCode;
        $this->billing = new PagSeguroBilling();
        if (isset($param) and is_array($param)) {
            $this->billing->setAddress(new PagSeguroAddress($param));
        } elseif ($param instanceof PagSeguroAddress) {
            $this->billing->setAddress($param);
        } else {
            $billindAdress = array(
                'postalCode' => $postalCode,
                'street' => $street,
                'number' => $number,
                'complement' => $complement,
                'district' => $district,
                'city' => $city,
                'state' => $state,
                'country' => $country
            );
            
            $this->billing->setAddress(new PagSeguroAddress($billindAdress));
        }
    }
475875
def geocode
      do_lookup(false) do |o,rs|
        if r = rs.first
          unless r.latitude.nil? or r.longitude.nil?
            o.__send__  "#{self.class.geocoder_options[:latitude]}=",  r.latitude
            o.__send__  "#{self.class.geocoder_options[:longitude]}=", r.longitude
          end
          r.coordinates
        end
      end
    end
228385
def to_latlon(geojson, origin_espg=None):
    

    if isinstance(geojson, dict):

        # get epsg code:
        if origin_espg:
            code = origin_espg
        else:
            code = epsg_code(geojson)
        if code:
            origin = Proj(init='epsg:%s' % code)
            wgs84 = Proj(init='epsg:4326')
            wrapped = test_wrap_coordinates(geojson['coordinates'], origin, wgs84)
            new_coords = convert_coordinates(geojson['coordinates'], origin, wgs84, wrapped)
            if new_coords:
                geojson['coordinates'] = new_coords
            try:
                del geojson['crs']
            except KeyError:
                pass

    return geojson
1288503
def postalCodeLookup(self, countryCode, postalCode):
        
        params = {"country": countryCode, "postalcode": postalCode}
        d = self._call("postalCodeLookupJSON", params)
        d.addCallback(operator.itemgetter("postalcodes"))
        return d
681631
def to_geocodeable_s
      a = [street_address, district, city, state, zip, country_code].compact
      a.delete_if { |e| !e || e == '' }
      a.join(', ')
    end
1157111
public function autocomplete($postalcode, $number = '', $extension = '')
    {
        $postalcode = $this->determinePostalType($postalcode);

        $this->data = array_merge($postalcode, ['streetnumber' => $number, 'extension' => $extension]);

        return $this->call('autocomplete', $this->prepareData($this->data));
    }
919377
public function getPostalCodes($elementIdx = 0)
    {
        if (true === array_key_exists($elementIdx, $this->postalCodes)) {
            return $this->postalCodes[$elementIdx];
        }

        if (false === array_key_exists($elementIdx, $this->response['elements'])) {
            throw new \Exception('Oups...');
        }

        if (true === array_key_exists('addr:postcode', $this->response['elements'][$elementIdx]['tags'])) {
            $postcode = $this->response['elements'][$elementIdx]['tags']['addr:postcode'];
            $this->postalCodes[$elementIdx] = explode(';', $postcode);

            // Ok... let's free a little bit of memory
            unset($this->response['elements'][$elementIdx]['tags']['addr:postcode']);
        } else {
            $this->postalCodes[$elementIdx] = null;
        }

        return $this->postalCodes[$elementIdx];
    }
467106
public function setPostcode($postcode)
    {
        if (!is_string($postcode) && !is_null($postcode)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not a string');
        }

        $this->postcode = $postcode;

        return $this;
    }
762169
public static function create_from_distance( $latlon, $distance ) {
    if ( ! ( $latlon instanceof LatLon ) ) {
      throw new GeocodingException( '$latlon parameter is not a LatLon object.' );
    }

    if ( ! Utils::validate_distance( $distance ) ) {
      throw new GeocodingException( 'Distance value is invalid: ' . $distance );
    }
    $distance = (string) $distance;

    // Calculate the bounding box on the globe.
    $center = \AnthonyMartin\GeoLocation\GeoLocation::fromDegrees( $latlon->get_lat(), $latlon->get_lon() );
    $bounds = $center->boundingCoordinates( $distance, 'miles' );

    $min = new LatLon( $bounds[0]->getLatitudeInDegrees(), $bounds[0]->getLongitudeInDegrees() );
    $max = new LatLon( $bounds[1]->getLatitudeInDegrees(), $bounds[1]->getLongitudeInDegrees() );

    return new LatLonRange( $min, $max );
  }
569766
public static function fromStdClass($_address)
    {
      $address = new static();

      if(isset($_address->country))
        $address->setCountry($_address->country);

      if(isset($_address->state))
        $address->setState($_address->state);

      if(isset($_address->municipality))
        $address->setMunicipality($_address->municipality);

      if(isset($_address->city))
        $address->setCity($_address->city);

      if(isset($_address->district))
        $address->setDistrict($_address->district);

      if(isset($_address->neighbourhood))
        $address->setNeighbourhood($_address->neighbourhood);

      if(isset($_address->street))
        $address->setStreet($_address->street);

      if(isset($_address->number))
        $address->setNumber($_address->number);

      if(isset($_address->addition))
        $address->setAddition($_address->addition);

      if(isset($_address->zipcode))
        $address->setZipcode($_address->zipcode);

      return $address;
    }
111487
public function getAddress($code): string
    {
        return $this->getProvince($code) . $this->getCity($code) . $this->getCounty($code);
    }
559612
function getGeocode($address) {
        if(empty($address))
            return false;
        $_geocode = false;  
        if(($_geocode = $this->getCache($address)) === false) {
        	if(($_geocode = $this->geoGetCoords($address)) !== false) {
            	$this->putCache($address, $_geocode['lon'], $_geocode['lat']);
            }
        }
        return $_geocode;
    }
1274487
private function getCountryByIsoCode( $iso_code ) {
		global $wpdb;
		$query          = "SELECT * FROM {$wpdb->base_prefix}geot_countries WHERE iso_code = %s";
		$result         = $wpdb->get_row( $wpdb->prepare( $query, array( $iso_code ) ), ARRAY_A );
		$country        = new \StdClass();
		$country->names = new \StdClass();

		$country->names->en = $result['country'];
		$country->iso_code  = $result['iso_code'];

		return $country;
	}
1149913
public static function country($code)
	{
		$adapter  = new \Geocoder\HttpAdapter\CurlHttpAdapter();

		$p = array();

		// Get a list of providers
		if ($providers = \Event::trigger('geocode.onGeocodeProvider', array('geocode.country', $adapter)))
		{
			foreach ($providers as $provider)
			{
				if ($provider)
				{
					$p[] = $provider;
				}
			}
		}

		if (!count($p))
		{
			return '';
		}

		// Instantiate the Geocoder service and pass it the list of providers
		$geocoder = new \Geocoder\Geocoder();
		$geocoder->registerProvider(new \Geocoder\Provider\ChainProvider($p));

		// Try to get some data...
		$geocoder->setResultFactory(new Result\CountryResultFactory());

		$country = $code;
		if ($data = $geocoder->geocode($code))
		{
			if (is_array($data))
			{
				$country = $data[0]->getCountry();
			}
			else
			{
				$country = $data->getCountry();
			}
		}
		return $country;
	}
1014284
public function setPostcode(\Chill\MainBundle\Entity\PostalCode $postcode = null)
    {
        $this->postcode = $postcode;

        return $this;
    }