How to geocode a address list to coordinate

Hi there,

I’ve a address list of electoral zones in Brazil, and I want to know what is the best way to find this adresses in osm.

This is a sample of the data:


"Address";"PostalCode";"District";"City";"State";
"AVENIDA FERNANDES LIMA, 3487";"57057000";"FAROL";"MACEIÓ";"AL"
"AVENIDA FERNANDES LIMA, 3487";"57057000";"FAROL";"MACEIÓ";"AL"
"AV FERNANDES LIMA, 3487";"57057000";"FAROL";"MACEIÓ";"AL"
"RUA VEREADOR HERMES DA FONSECA MATA, S/N";"57660000";"CENTRO";"ANADIA";"AL"
"RUA FREDERICO MAIA,S/Nº";"57700000";"CENTRO";"VIÇOSA";"AL"
"AV PEDRO PEREIRA ACIOLI, SN";"57690000";"JOSE PAULINO";"ATALAIA";"AL"
"RUA MADRE DE DEUS, 427";"03119000";"MOOCA";"SÃO PAULO";"SP"
"RUA LEOPOLDO COUTO MAGALHAES JR., 1363";"04542012";"ITAIM BIBI";"SÃO PAULO";"SP"
"RUA LOEFGREEN, 2007";"04040033";"VILA CLEMENTINO";"SÃO PAULO";"SP"
"AV. CELIDONIO NETO, N. 165";"17120000";"CENTRO";"AGUDOS";"SP"
"RUA CAPITÃO MIRANDA 57";"13900030";"CENTRO";"AMPARO";"SP"
"RUA PARANA, 701";"16901155";"STELLA MARIS";"ANDRADINA";"SP"

Thanks!

You can do some calls to the Nominatim search API. I dont think postcodes in Brasil will work, but if you search for “{address}, {city}”. This might work. For example the first row of your file could be turned into this URL:

http://nominatim.openstreetmap.org/search?q=AVENIDA+FERNANDES+LIMA,MACEI%C3%93&format=xml&polygon=1&addressdetails=1

Then you have to work with the results e.g. take the lat and lon attributes of the first tag returned

But if you’re doing this for a very large file, you should be aware of the Nominatim usage policy (Maybe you’d have to take a different approach)