# How to look for geocodes in Germany only? (PLZ or Postleitzahl)

**URL:** <https://discuss.elastic.co/t/how-to-look-for-geocodes-in-germany-only-plz-or-postleitzahl/19771>\
**Category:** Elasticsearch\
**Created:** [September 13, 2014, 5:58pm UTC](https://discuss.elastic.co/t/how-to-look-for-geocodes-in-germany-only-plz-or-postleitzahl/19771 "2014-09-13T17:58:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jahn](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@Jahn](https://discuss.elastic.co/u/Jahn)\
**Post date:** [September 13, 2014, 5:58pm UTC](https://discuss.elastic.co/t/how-to-look-for-geocodes-in-germany-only-plz-or-postleitzahl/19771/1 "2014-09-13T17:58:48Z")

</div>

Not sure whether I am in the right forum, so I apologize if this is not the  
place to post!

I would like to switch from US "zip" codes to PLZ (Postleitzahlen) in  
Germany. If I enter a German "zip" or "PLZ" code into the code below (for  
$zip), the system is looking everywhere in the world ... including Germany.  
What would be the proper code to only search within Germany?

Here is what works for the US:

```
    protected function getlatlonforzip($zip) 
    { 
            $url = 

```

"[http://query.yahooapis.com/v1/public/yql?q=select%20\*%20from%20geo.placefinder%20where%20text%3D"".$zip.""&format=json](http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22%22.%24zip.%22%22&format=json)";  
$o = json\_decode(file\_get\_contents($url));  
$x = $o-\>query-\>results-\>Result;  
return array($x-\>latitude, $x-\>longitude);  
}

Thank you very much!

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6d08aabe-1cb5-4ff1-9e02-8d26eace2d03%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6d08aabe-1cb5-4ff1-9e02-8d26eace2d03%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)\
**Post date:** [September 13, 2014, 6:54pm UTC](https://discuss.elastic.co/t/how-to-look-for-geocodes-in-germany-only-plz-or-postleitzahl/19771/2 "2014-09-13T18:54:08Z")

</div>

This is completely off-topic, but I allow myself to answer.

Use Google Geocoding API, example:

[http://maps.googleapis.com/maps/api/geocode/json?address=50674&region=de](http://maps.googleapis.com/maps/api/geocode/json?address=50674&region=de)

> **[Tài liệu về Nền tảng Google Maps
  
  |  Geocoding API...](https://developers.google.com/maps/documentation/geocoding?hl=vi)**
>
> Tài liệu về Nền tảng Google Maps

Jörg

On Sat, Sep 13, 2014 at 7:58 PM, Jahn [animoduro@gmail.com](mailto:animoduro@gmail.com) wrote:

> Not sure whether I am in the right forum, so I apologize if this is not  
> the place to post!
> 
> I would like to switch from US "zip" codes to PLZ (Postleitzahlen) in  
> Germany. If I enter a German "zip" or "PLZ" code into the code below (for  
> $zip), the system is looking everywhere in the world ... including Germany.  
> What would be the proper code to only search within Germany?
> 
> Here is what works for the US:
> 
> ```
> protected function getlatlonforzip($zip)
> {
> $url = "
> 
> ```
> 
> [http://query.yahooapis.com/v1/public/yql?q=select%20\*%20from%20geo.placefinder%20where%20text%3D"](http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20geo.placefinder%20where%20text%3D%22)  
> ".$zip."%22&format=json";  
> $o = json\_decode(file\_get\_contents($url));  
> $x = $o-\>query-\>results-\>Result;  
> return array($x-\>latitude, $x-\>longitude);  
> }
> 
> Thank you very much!
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/6d08aabe-1cb5-4ff1-9e02-8d26eace2d03%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6d08aabe-1cb5-4ff1-9e02-8d26eace2d03%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/6d08aabe-1cb5-4ff1-9e02-8d26eace2d03%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/6d08aabe-1cb5-4ff1-9e02-8d26eace2d03%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGXBT0twozNZ88XPoLaDzBjkCrgAcJOU%2Bqzr3N3GJ%2BB-g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoGXBT0twozNZ88XPoLaDzBjkCrgAcJOU%2Bqzr3N3GJ%2BB-g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:02am UTC](https://discuss.elastic.co/t/how-to-look-for-geocodes-in-germany-only-plz-or-postleitzahl/19771/3 "2017-07-06T01:02:34Z")

</div>


