Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-09 Thread Glenn Plas
>>
>> You don't repeat addr:city or addr:country and on every node/building in
>> Belgium either, we know where it is by using the coordinates.  It's the
>> same for postal codes once you have the boundary borders, it's piece of
>> cake in any programming language to figure out if a point is inside or
>> outside a polygon.
> 
> I agree.
> 
> For the website ici.brussels how do you load the POI ?
> 
> If you do it in you php script you can load all the POI, then all the
> postcodes then use a library like https://github.com/phayes/geoPHP to
> compute the postal code of the POI.

you don't even need a (huge) library to do this. Turns out my math
classes were useful after all.

I would just download the boundaries relations ways, represent them in
PHP as a polygon, verify if these polygons are ok (needs to be closed,
very important) , then check which one of the polygons are closest (so
you don't have to analyse them all) and run it through something like this:

//  intpolySides  =  how many corners the polygon has
//  float  polyX[]=  horizontal coordinates of corners
//  float  polyY[]=  vertical coordinates of corners
//  float  x, y   =  point to be tested

/* The function will return YES if the point x,y is inside the polygon,
or NO if it is not.  If the point is exactly on the edge of the polygon,
then the function may return YES or NO.

Note that division by zero is avoided because the division is protected
by the "if" clause which surrounds it.
*/

function pointInPolygon($polySides, $polyX, $polyY, $x, $y) {
$j=$polySides-1 ;
$oddNodes=false;

for ($i=0; $i<$polySides; $i++) {
if (($polyY[$i]<$y && $polyY[$j]>=$y) OR ($polyY[$j]<$y
&& $polyY[$i]>=$y)) {
if
($polyX[$i]+($y-$polyY[$i])/($polyY[$j]-$polyY[$i])*($polyX[$j]-$polyX[$i])<$x)
{
$oddNodes=!$oddNodes;
}
}
$j=$i;
}

  return $oddNodes;
}

Glenn


___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-07 Thread Marc Ducobu
On 7 December 2015 at 18:30, Glenn Plas  wrote:
> On 06-12-15 18:25, Bruno Veyckemans wrote:
>> OK, Thanks for your answers.
>>
>> I understand that some of you consider postal code as redundant
>> information in Belgium. Maybe it is... but I'm not 100% convinced ;-)
>
> I consider repeating addr:postcode on every bloody building (node or
> way) in OSM a severe waste of resources, not only in size of the databse
> but also in efforts by mappers... relations are exactly meant to make
> your live easier by not repeating the same information over an over
> again that can easily be derived from existing data itself.
>
> You really don't have to calculate it  http://overpass-turbo.eu/s/d8S
>
> The only reason I believe it is useful is when a bordercase goes wrong
> and you want to help geocoding/reverse geocoding a bit.
>
> You don't repeat addr:city or addr:country and on every node/building in
> Belgium either, we know where it is by using the coordinates.  It's the
> same for postal codes once you have the boundary borders, it's piece of
> cake in any programming language to figure out if a point is inside or
> outside a polygon.

I agree.

For the website ici.brussels how do you load the POI ?

If you do it in you php script you can load all the POI, then all the
postcodes then use a library like https://github.com/phayes/geoPHP to
compute the postal code of the POI.

>
>
>> When I use OSM as a database with Overpass Turbo, I like to receive
>> postal code as a variable and display it without having to calculate it
>> (maybe there's another way to do this ?).
>
> Again, that word calculate, makes me wonder where that idea comes from.
>  Could you elaborate ?
>
>> PS: I hope this answer will be associated with the correct thread...
>> This is my first answer in the mailing-list and I'm definitely not a geek :)
>
> I found it! So A-OK.  Welcome!
>
> Glenn
>
>
> ___
> Talk-be mailing list
> Talk-be@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk-be



-- 
et en avant pour de folles aventures...

___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-07 Thread Glenn Plas
On 06-12-15 18:25, Bruno Veyckemans wrote:
> OK, Thanks for your answers.
> 
> I understand that some of you consider postal code as redundant
> information in Belgium. Maybe it is... but I'm not 100% convinced ;-)

I consider repeating addr:postcode on every bloody building (node or
way) in OSM a severe waste of resources, not only in size of the databse
but also in efforts by mappers... relations are exactly meant to make
your live easier by not repeating the same information over an over
again that can easily be derived from existing data itself.

You really don't have to calculate it  http://overpass-turbo.eu/s/d8S

The only reason I believe it is useful is when a bordercase goes wrong
and you want to help geocoding/reverse geocoding a bit.

You don't repeat addr:city or addr:country and on every node/building in
Belgium either, we know where it is by using the coordinates.  It's the
same for postal codes once you have the boundary borders, it's piece of
cake in any programming language to figure out if a point is inside or
outside a polygon.


> When I use OSM as a database with Overpass Turbo, I like to receive
> postal code as a variable and display it without having to calculate it
> (maybe there's another way to do this ?).

Again, that word calculate, makes me wonder where that idea comes from.
 Could you elaborate ?

> PS: I hope this answer will be associated with the correct thread...
> This is my first answer in the mailing-list and I'm definitely not a geek :)

I found it! So A-OK.  Welcome!

Glenn


___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-06 Thread Bruno Veyckemans
OK, Thanks for your answers.

I understand that some of you consider postal code as redundant information
in Belgium. Maybe it is... but I'm not 100% convinced ;-)
When I use OSM as a database with Overpass Turbo, I like to receive postal
code as a variable and display it without having to calculate it (maybe
there's another way to do this ?).

Whatever, I think I'll focus on something more useful for the community,
like finding automatically incorrect streetnames (in Brussels, I often find
streetnames only in french or dutch in node or ways attributes, or
misspellings). I'll work on this and prepare a special page for these
findings...

Bruno

PS: I hope this answer will be associated with the correct thread... This
is my first answer in the mailing-list and I'm definitely not a geek :)
___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-06 Thread Sander Deryckere
2015-12-06 19:25 GMT+01:00 Bruno Veyckemans :

> OK, Thanks for your answers.
>
> I understand that some of you consider postal code as redundant
> information in Belgium. Maybe it is... but I'm not 100% convinced ;-)
> When I use OSM as a database with Overpass Turbo, I like to receive postal
> code as a variable and display it without having to calculate it (maybe
> there's another way to do this ?).
>
> Overpass turbo can limit a query to an area (and thus to a postal code),
and it can also query the areas a certain position belongs to (and return
the postal code). If you want to split info by postal code (f.e. for
statistical purposes), you'll indeed need a script. But with a separate
postal_code extract, and a geographic library, it shouldn't be too hard.


> Whatever, I think I'll focus on something more useful for the community,
> like finding automatically incorrect streetnames (in Brussels, I often find
> streetnames only in french or dutch in node or ways attributes, or
> misspellings). I'll work on this and prepare a special page for these
> findings...
>
>
Yes, there are still problems in Brussels with streetnames. See
http://tools.geofabrik.de/osmi/?view=addresses=4.35285=50.84048=14=no_addr_street,street_not_found,interpolation_errors
for basic address checks (addr:street matching the name tag).

Not only with language order, but also with small words (de, du, ...) that
need to be checked locally. Also see the discussion about language
facilities, where the number of name:nl and name:fr tagged streets is
embarrassingly low.

Regards,
Sander
___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


[OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-04 Thread Bruno Veyckemans
[FR] Bonjour à tous,

Poursuivant ma quête de faire d'OSM une base de données à jour d'infos sur
Bruxelles, je me suis rendu compte que très souvent les codes postaux ne
sont pas renseignés alors que c'est une information fastidieuse à vérifier
"manuellement", mais facile à obtenir de façon automatisée.

Exemple avec cette liste des librairies de Bruxelles:
http://ici.brussels/liste-librairies Les codes postaux apparaissent en noir
s'ils sont encodés dans OSM, en gris s'ils sont trouvés grâce à un script
que j'ai créé en utilisant les webservices d'Urbis. Sur mon site, ça
fonctionne très bien: si l'adresse est encodée sans CP, le script vérifie
auprès d'Urbis si celle-ci correspond bien à un et un seul code postal à
Bruxelles, et si c'est le cas il l'affiche.

J'ai lu la doc d'OSM au sujet des robots, et j'en retiens essentiellement
qu'il faut faire attention à ne pas rater son coup (forcément) ni froisser
les autres utilisateurs d'OSM. D'où ma question: trouvez-vous qu'un script
qui complète les codes postaux manquants sur base d'Urbis serait perçu
positivement ?

Concrètement, l'ajout serait de ce type: addr:postcode => 1060 | addr:city
=> Saint-Gilles - Sint-Gillis

Par ailleurs, l'un d'entre vous a-t-il déjà développé un tel script pour
les données "belges" ? Je code en PHP, si quelqu'un a une expérience à
partager avant que je me lance, je prends...

PS: Merci pour vos réponses à ma demande précédente, j'ai reçu beaucoup
d'infos très intéressantes et noué de chouettes échanges... En plus, grâce
à l'aide de quelques mappers, les musées de Bruxelles sont désormais quasi
à jour sur OSM: http://ici.brussels/liste-musees

PS 2: Si vous avez l'occasion de voter pour le projet "OpenStreetMap" de
Smartcity Bruxelles (actuellement #14), ça se passe ici et je pense que
c'est l'occasion de faire passer un message important !
http://smartcity.brussels/participer


[EN] Hello,

Following my wish to use OSM as a database for Brussels, I saw that postal
codes are often missing however it is easy to know it using a script. I
created a script that works perfectly to guess the postal code using Urbis
webservices (example here for the bookshops - postal codes missing in OSM
appear in grey: http://ici.brussels/liste-librairies ) and wanted to know
if you think it would be a good idea to automatically add this information
with a "bot".

I read the doc about the bots and keep in mind that I must behave carefully
(obviously) but also that this has to be "acceptable" for the community. So
do you think this would be a fair use of OSM to create such a script ?

Thanks,
Bruno

PS: Vote for the proposal about OpenStreetMap on Brussels Smartcity's
website ! http://smartcity.brussels/getting-involved (for now #14)
___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-04 Thread Jo
Quand j'ai préparé l'import d'UrbIS, j'ai prévu des relations
associatedStreet dans lesquels les codes postaux sont présents. Ils sont
donc bien présents dans les données, à condition que la personne qui a fait
l'import les a reprises. (et si elles n'ont pas été effacées entretemps)

When I prepared the UrbIS import, I made sure all addresses were part of
associatedStreet relations. The postal codes are in there, but only if
those relations were imported as well (and when they haven't been deleted
in the mean time)

Jo

2015-12-04 12:15 GMT+01:00 Bruno Veyckemans :

> [FR] Bonjour à tous,
>
> Poursuivant ma quête de faire d'OSM une base de données à jour d'infos sur
> Bruxelles, je me suis rendu compte que très souvent les codes postaux ne
> sont pas renseignés alors que c'est une information fastidieuse à vérifier
> "manuellement", mais facile à obtenir de façon automatisée.
>
> Exemple avec cette liste des librairies de Bruxelles:
> http://ici.brussels/liste-librairies Les codes postaux apparaissent en
> noir s'ils sont encodés dans OSM, en gris s'ils sont trouvés grâce à un
> script que j'ai créé en utilisant les webservices d'Urbis. Sur mon site, ça
> fonctionne très bien: si l'adresse est encodée sans CP, le script vérifie
> auprès d'Urbis si celle-ci correspond bien à un et un seul code postal à
> Bruxelles, et si c'est le cas il l'affiche.
>
> J'ai lu la doc d'OSM au sujet des robots, et j'en retiens essentiellement
> qu'il faut faire attention à ne pas rater son coup (forcément) ni froisser
> les autres utilisateurs d'OSM. D'où ma question: trouvez-vous qu'un script
> qui complète les codes postaux manquants sur base d'Urbis serait perçu
> positivement ?
>
> Concrètement, l'ajout serait de ce type: addr:postcode => 1060 | addr:city
> => Saint-Gilles - Sint-Gillis
>
> Par ailleurs, l'un d'entre vous a-t-il déjà développé un tel script pour
> les données "belges" ? Je code en PHP, si quelqu'un a une expérience à
> partager avant que je me lance, je prends...
>
> PS: Merci pour vos réponses à ma demande précédente, j'ai reçu beaucoup
> d'infos très intéressantes et noué de chouettes échanges... En plus, grâce
> à l'aide de quelques mappers, les musées de Bruxelles sont désormais quasi
> à jour sur OSM: http://ici.brussels/liste-musees
>
> PS 2: Si vous avez l'occasion de voter pour le projet "OpenStreetMap" de
> Smartcity Bruxelles (actuellement #14), ça se passe ici et je pense que
> c'est l'occasion de faire passer un message important !
> http://smartcity.brussels/participer
>
>
> [EN] Hello,
>
> Following my wish to use OSM as a database for Brussels, I saw that postal
> codes are often missing however it is easy to know it using a script. I
> created a script that works perfectly to guess the postal code using Urbis
> webservices (example here for the bookshops - postal codes missing in OSM
> appear in grey: http://ici.brussels/liste-librairies ) and wanted to know
> if you think it would be a good idea to automatically add this information
> with a "bot".
>
> I read the doc about the bots and keep in mind that I must behave
> carefully (obviously) but also that this has to be "acceptable" for the
> community. So do you think this would be a fair use of OSM to create such a
> script ?
>
> Thanks,
> Bruno
>
> PS: Vote for the proposal about OpenStreetMap on Brussels Smartcity's
> website ! http://smartcity.brussels/getting-involved (for now #14)
>
> ___
> Talk-be mailing list
> Talk-be@openstreetmap.org
> https://lists.openstreetmap.org/listinfo/talk-be
>
>
___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-04 Thread Sander Deryckere
(Sorry, my French is too bad to write in a readable way, so I'll just
answer in English).

Hi Bruno,

In Belgium, we have the advantage that postal codes are mostly geographical
(with a few exceptions, like the NATO or the VRT/RTBF buildings). This is
in contrast to f.e. the UK, where postcodes are placed on streets instead
of on areas.

Most of the Belgian postcode boundaries are already complete (there are
still some holes on villages where we lack precise boundaries). And any
decent geocoder or GIS system should be able to process areas, and query
the addresses inside an area to assign the postal codes to it. Even JOSM
can select all features in an area (thanks to a plugin), and it's not a GIS
system but merely an editor.

As with other OSM data, there are multiple ways to map postal codes:
* Mapping it on every address
* Mapping it on a street-relation
* Mapping it on a boundary

And I prefer the one with the least amount of redundancy here: the boundary.

When I worked on the tool to import Agiv addresses to OSM, I specifically
put the addr:postcode and addr:city tags as optional. So the mapper can
decide whether he wants it for a certain reason or not (f.e. easier
searching while editing).

Note that Belgium isn't the only place where postcode boundaries are used,
it's used in Germany too, so tools have to support this way of mapping.

http://taginfo.openstreetmap.org/tags/boundary=postal_code#map

Regards,
Sander
___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be


Re: [OSM-talk-be] Robot pour CP manquants à Bruxelles - A bot for missing postal codes [FR-EN]

2015-12-04 Thread Marc Gemis
On Fri, Dec 4, 2015 at 1:36 PM, Sander Deryckere  wrote:
> Most of the Belgian postcode boundaries are already complete

In Flanders, I see a lot of missing data in Wallonia.
http://overpass-turbo.eu/s/d5W (or is my query wrong ?)

m.

___
Talk-be mailing list
Talk-be@openstreetmap.org
https://lists.openstreetmap.org/listinfo/talk-be