From 272fcc172ec411d43e68e8a02c381691300fd681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mar=C3=ADn?= Date: Tue, 20 Mar 2012 21:39:56 +0100 Subject: [PATCH 1/5] =?UTF-8?q?Corregidas=20erratas=20en=20traducci=C3=B3n?= =?UTF-8?q?=20de=20etiquetas=20de=20catastro?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Cat2Osm.java | 209 +++++++++++++++-------------------------------- 1 file changed, 68 insertions(+), 141 deletions(-) diff --git a/src/Cat2Osm.java b/src/Cat2Osm.java index f960ad6..25913af 100644 --- a/src/Cat2Osm.java +++ b/src/Cat2Osm.java @@ -1159,11 +1159,6 @@ public static List usoInmueblesParser(String codigo){ case "E": case "F": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "culture"; - l.add(s); return l; case "G": @@ -1178,11 +1173,6 @@ public static List usoInmueblesParser(String codigo){ case "K": case "L": - s[0] = "*landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "sports"; - l.add(s); return l; case "M": @@ -1209,11 +1199,6 @@ public static List usoInmueblesParser(String codigo){ case "T": case "U": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); return l; case "V": @@ -1252,8 +1237,6 @@ public static List destinoParser(String codigo){ switch (codigo){ case "A": case "B": - s[0] = "*landuse"; s[1] ="farmyard"; - l.add(s); return l; case "AAL": @@ -1267,7 +1250,7 @@ public static List destinoParser(String codigo){ s[0] = "amenity"; s[1] = "parking"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Comprobar que sea parking publico o al aire libre, en caso de no serlo deberia ser building=garage o landuse=garages"; + s[0] = "fixme"; s[1] = "Comprobar que sea parking publico o al aire libre. En caso de no serlo, si ocupa todo el edificio deberia ser building=garage o landuse=garages"; l.add(s); return l; @@ -1513,7 +1496,7 @@ public static List destinoParser(String codigo){ case "ECL": case "FCL": - s[0] = "amenity"; s[1] = "comunity_centre"; + s[0] = "amenity"; s[1] = "community_centre"; l.add(s); return l; @@ -1750,18 +1733,15 @@ public static List destinoParser(String codigo){ case "GT1": case "HT1": - return l; - case "GT2": case "HT2": - return l; - case "GT3": case "HT3": - return l; - case "GTL": case "HTL": + // Como no sabemos a qué se puede referir esto, mejor ponemos un fixme + s[0] = "fixme"; s[1] = "Documentar codificación de los usos de los bienes inmuebles en catastro código="+ codigo +" en http://wiki.openstreetmap.org/wiki/Traduccion_metadatos_catastro_a_map_features#Codificacion_de_los_usos_de_los_bienes_inmuebles"; + l.add(s); return l; case "I": @@ -1773,9 +1753,9 @@ public static List destinoParser(String codigo){ l.add(s); return l; - case "IAJ": + case "IAG": case "JAG": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; s[0] = "man_made"; s[1] = "works"; @@ -1787,7 +1767,7 @@ public static List destinoParser(String codigo){ case "IAL": case "JAL": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; s[0] = "man_made"; s[1] = "works"; @@ -1799,7 +1779,7 @@ public static List destinoParser(String codigo){ case "IAM": case "JAM": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; s[0] = "man_made"; s[1] = "storage_tank"; @@ -1811,10 +1791,10 @@ public static List destinoParser(String codigo){ case "IAR": case "JAR": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "agricultural"; @@ -1823,7 +1803,7 @@ public static List destinoParser(String codigo){ case "IAS": case "JAS": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; s[0] = "craft"; s[1] = "sawmill"; @@ -1832,10 +1812,10 @@ public static List destinoParser(String codigo){ case "IBB": case "JBB": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "drinks"; @@ -1844,10 +1824,10 @@ public static List destinoParser(String codigo){ case "IBD": case "JBD": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "winery"; @@ -1856,10 +1836,10 @@ public static List destinoParser(String codigo){ case "IBR": case "JBR": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "ceramic"; @@ -1868,10 +1848,10 @@ public static List destinoParser(String codigo){ case "ICH": case "JCH": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "mushrooms"; @@ -1880,10 +1860,10 @@ public static List destinoParser(String codigo){ case "ICN": case "JCN": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "building"; @@ -1892,10 +1872,10 @@ public static List destinoParser(String codigo){ case "ICT": case "JCT": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "quarry"; @@ -1904,10 +1884,10 @@ public static List destinoParser(String codigo){ case "IEL": case "JEL": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "electric"; @@ -1922,10 +1902,10 @@ public static List destinoParser(String codigo){ case "IIM": case "JIM": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "chemistry"; @@ -1940,10 +1920,10 @@ public static List destinoParser(String codigo){ case "IMD": case "JMD": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "wood"; @@ -1952,10 +1932,10 @@ public static List destinoParser(String codigo){ case "IMN": case "JMN": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "manufacturing"; @@ -1964,10 +1944,10 @@ public static List destinoParser(String codigo){ case "IMT": case "JMT": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "metal"; @@ -1976,10 +1956,10 @@ public static List destinoParser(String codigo){ case "IMU": case "JMU": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "machinery"; @@ -1988,10 +1968,10 @@ public static List destinoParser(String codigo){ case "IPL": case "JPL": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "plastics"; @@ -2000,10 +1980,10 @@ public static List destinoParser(String codigo){ case "IPP": case "JPP": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "paper"; @@ -2012,10 +1992,10 @@ public static List destinoParser(String codigo){ case "IPS": case "JPS": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "fishing"; @@ -2024,10 +2004,10 @@ public static List destinoParser(String codigo){ case "IPT": case "JPT": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "petroleum"; @@ -2036,10 +2016,10 @@ public static List destinoParser(String codigo){ case "ITB": case "JTB": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "tobacco"; @@ -2048,10 +2028,10 @@ public static List destinoParser(String codigo){ case "ITX": case "JTX": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "clothing"; @@ -2060,10 +2040,10 @@ public static List destinoParser(String codigo){ case "IVD": case "JVD": - s[0] = "tourism"; s[1] = "hostel"; + s[0] = "landuse"; s[1] = "industrial"; l.add(s); s = new String[2]; - s[0] = "man_made"; s[1] = "storage_tank"; + s[0] = "man_made"; s[1] = "works"; l.add(s); s = new String[2]; s[0] = "works"; s[1] = "glass"; @@ -2072,19 +2052,13 @@ public static List destinoParser(String codigo){ case "K": case "L": - s[0] = "*landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "sports"; + s[0] = "*landuse"; s[1] = "sports"; l.add(s); return l; case "KDP": case "LDP": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "sports"; + s[0] = "landuse"; s[1] = "sports"; l.add(s); s = new String[2]; s[0] = "leisure"; s[1] = "pitch"; @@ -2096,10 +2070,7 @@ public static List destinoParser(String codigo){ case "KES": case "LES": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "sports"; + s[0] = "landuse"; s[1] = "sports"; l.add(s); s = new String[2]; s[0] = "leisure"; s[1] = "stadium"; @@ -2111,10 +2082,7 @@ public static List destinoParser(String codigo){ case "KPL": case "LPL": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "sports"; + s[0] = "landuse"; s[1] = "sports"; l.add(s); s = new String[2]; s[0] = "leisure"; s[1] = "sports_centre"; @@ -2126,10 +2094,7 @@ public static List destinoParser(String codigo){ case "KPS": case "LPS": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "sports"; + s[0] = "landuse"; s[1] = "sports"; l.add(s); s = new String[2]; s[0] = "leisure"; s[1] = "swimming_pool"; @@ -2156,7 +2121,7 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", Profesional superior. Afinar office=X si es posible."; l.add(s); return l; @@ -2165,7 +2130,7 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", Profesional medio. Afinar office=X si es posible."; l.add(s); return l; @@ -2174,7 +2139,7 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", Médicos, abogados... Afinar office=X si es posible."; l.add(s); return l; @@ -2195,7 +2160,7 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", Profesores Mercant. Afinar office=X si es posible."; l.add(s); return l; @@ -2204,7 +2169,7 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", Profesores Universitarios. Afinar office=X si es posible."; l.add(s); return l; @@ -2249,7 +2214,7 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", agentes. Afinar office=X si es posible."; l.add(s); return l; @@ -2294,16 +2259,16 @@ public static List destinoParser(String codigo){ s[0] = "landuse"; s[1] = "commercial"; l.add(s); s = new String[2]; - s[0] = "fixme"; s[1] = "Codigo="+codigo+", afinar office=X si es posible."; + s[0] = "fixme"; s[1] = "Codigo="+codigo+", otras actividades. Afinar office=X si es posible."; l.add(s); return l; case "P": case "Q": - s[0] = "amenity"; s[1] = "public_building"; + s[0] = "*amenity"; s[1] = "public_building"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "*building"; s[1] = "public"; l.add(s); return l; @@ -2473,69 +2438,34 @@ public static List destinoParser(String codigo){ case "T": case "U": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); return l; case "TAD": case "UAD": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); - s = new String[2]; s[0] = "amenity"; s[1] = "auditorium"; l.add(s); return l; case "TCM": case "UCM": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); - s = new String[2]; s[0] = "amenity"; s[1] = "cinema"; l.add(s); return l; case "TCN": case "UCN": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); - s = new String[2]; s[0] = "amenity"; s[1] = "cinema"; l.add(s); return l; case "TSL": case "USL": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); - s = new String[2]; s[0] = "amenity"; s[1] = "hall"; l.add(s); return l; case "TTT": case "UTT": - s[0] = "landuse"; s[1] = "recreation_ground"; - l.add(s); - s = new String[2]; - s[0] = "recreation_type"; s[1] = "entertainment"; - l.add(s); - s = new String[2]; s[0] = "amenity"; s[1] = "theatre"; l.add(s); return l; @@ -2547,13 +2477,7 @@ public static List destinoParser(String codigo){ return l; case "Y": - s[0] = "*landuse"; s[1] = "health"; - l.add(s); - return l; - case "Z": - s[0] = "*landuse"; s[1] = "farm"; - l.add(s); return l; case "YAM": @@ -2676,6 +2600,9 @@ public static List destinoParser(String codigo){ case "YHG": case "ZHG": + // Como no sabemos a qué se puede referir esto, mejor ponemos un fixme + s[0] = "fixme"; s[1] = "Documentar codificación de los usos de los bienes inmuebles en catastro código="+ codigo +" en http://wiki.openstreetmap.org/wiki/Traduccion_metadatos_catastro_a_map_features#Codificacion_de_los_usos_de_los_bienes_inmuebles"; + l.add(s); return l; case "YHS": @@ -2769,7 +2696,7 @@ public static List destinoParser(String codigo){ default: if (!codigo.isEmpty()){ - s[0] = "fixme"; s[1] = "Documentar nuevo codificación de los usos de los vienes inmuebles en catastro código="+ codigo +" en http://wiki.openstreetmap.org/wiki/Traduccion_metadatos_catastro_a_map_features#Codificacion_de_los_usos_de_los_bienes_inmuebles"; + s[0] = "fixme"; s[1] = "Documentar nuevo codificación de los usos de los bienes inmuebles en catastro código="+ codigo +" en http://wiki.openstreetmap.org/wiki/Traduccion_metadatos_catastro_a_map_features#Codificacion_de_los_usos_de_los_bienes_inmuebles"; l.add(s);} From 7f06c35039b503ece97862d69325cb3d7f6de4a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mar=C3=ADn?= Date: Tue, 20 Mar 2012 21:50:41 +0100 Subject: [PATCH 2/5] =?UTF-8?q?La=20direcci=C3=B3n=20no=20estructurada=20n?= =?UTF-8?q?o=20es=20addr:full,=20sino=20algo=20como=20el=20nombre=20de=20u?= =?UTF-8?q?n=20edificio.=20Lo=20pongo=20en=20etiqueta=20name.=20El=20c?= =?UTF-8?q?=C3=B3digo=20postal=20debe=20tener=205=20cifras,=20independient?= =?UTF-8?q?emente=20de=20los=20ceros=20a=20la=20izquierda.=20El=20n=C3=BAm?= =?UTF-8?q?ero=20de=20la=20calle=20puede=20tener=20sufijos,=20como=20b,c..?= =?UTF-8?q?.=20que=20forman=20parte=20del=20n=C3=BAmero=20de=20polic=C3=AD?= =?UTF-8?q?a=20y=20vienen=20en=20el=20campo=20primera=20letra.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Cat2Osm.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cat2Osm.java b/src/Cat2Osm.java index 25913af..32e8ebf 100644 --- a/src/Cat2Osm.java +++ b/src/Cat2Osm.java @@ -750,16 +750,16 @@ private static Cat catLineParser(String line) throws IOException{ //c.addAttribute("NOMBRE DE VIA PUBLICA",line.substring(163,188)); c.addAttribute("addr:street",nombreTipoViaParser(line.substring(158,163).trim())+" "+formatearNombreCalle(eliminarComillas(line.substring(163,188).trim()))); //c.addAttribute("PRIMER NUMERO DE POLICIA",line.substring(188,192)); - c.addAttribute("addr:housenumber",eliminarCerosString(line.substring(188,192))); //c.addAttribute("PRIMERA LETRA (CARACTER DE DUPLICADO)",line.substring(192,193)); + c.addAttribute("addr:housenumber",eliminarCerosString(line.substring(188,192))+line.substring(192,193).trim()); //c.addAttribute("SEGUNDO NUMERO DE POLICIA",line.substring(193,197)); //c.addAttribute("SEGUNDA LETRA (CARACTER DE DUPLICADO)",line.substring(197,198)); //c.addAttribute("KILOMETRO (3enteros y 2decimales)",line.substring(198,203)); //c.addAttribute("BLOQUE",line.substring(203,207)); //c.addAttribute("TEXTO DE DIRECCION NO ESTRUCTURADA",line.substring(215,240)); - c.addAttribute("addr:full",eliminarComillas(line.substring(215,240))); + c.addAttribute("name",eliminarComillas(line.substring(215,240))); //c.addAttribute("CODIGO POSTAL",line.substring(240,245)); - c.addAttribute("addr:postcode",eliminarCerosString(line.substring(240,245))); + c.addAttribute("addr:postcode", line.substring(240,245)); c.addAttribute("addr:country","ES"); //c.addAttribute("DISTRITO MUNICIPAL",line.substring(245,247)); //c.addAttribute("CODIGO DEL MUNICIPIO ORIGEN EN CASO DE AGREGACION",line.substring(247,250)); From 7a84688be2eb6e624ba878bc9dedc2781c574dd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mar=C3=ADn?= Date: Tue, 20 Mar 2012 21:54:16 +0100 Subject: [PATCH 3/5] Repitiendo los cambios, pero para registros de tipo 15 --- src/Cat2Osm.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Cat2Osm.java b/src/Cat2Osm.java index 32e8ebf..1dfc165 100644 --- a/src/Cat2Osm.java +++ b/src/Cat2Osm.java @@ -907,8 +907,8 @@ private static Cat catLineParser(String line) throws IOException{ //c.addAttribute("NOMBRE DE VIA PUBLICA",line.substring(205,230)); c.addAttribute("addr:street",nombreTipoViaParser(line.substring(200,205).trim())+" "+formatearNombreCalle(eliminarComillas(line.substring(205,230).trim()))); //c.addAttribute("PRIMER NUMERO DE POLICIA",line.substring(230,234)); - c.addAttribute("addr:housenumber",eliminarCerosString(line.substring(230,234))); //c.addAttribute("PRIMERA LETRA (CARACTER DE DUPLICADO)",line.substring(234,235)); + c.addAttribute("addr:housenumber",eliminarCerosString(line.substring(230,234))+line.substring(234,235).trim()); //c.addAttribute("SEGUNDO NUMERO DE POLICIA",line.substring(235,239)); //c.addAttribute("SEGUNDA LETRA (CARACTER DE DUPLICADO)",line.substring(239,240)); //c.addAttribute("KILOMETRO (3enteros y 2decimales)",line.substring(240,245)); @@ -917,9 +917,9 @@ private static Cat catLineParser(String line) throws IOException{ //c.addAttribute("PLANTA",line.substring(251,254)); //c.addAttribute("PUERTA",line.substring(254,257)); //c.addAttribute("TEXTO DE DIRECCION NO ESTRUCTURADA",line.substring(257,282)); - c.addAttribute("addr:full",eliminarComillas(line.substring(257,282).trim())); + c.addAttribute("name",eliminarComillas(line.substring(257,282).trim())); //c.addAttribute("CODIGO POSTAL",line.substring(282,287)); - c.addAttribute("addr:postcode",eliminarCerosString(line.substring(282,287))); + c.addAttribute("addr:postcode",line.substring(282,287)); c.addAttribute("addr:country" ,"ES"); //c.addAttribute("DISTRITO MUNICIPAL",line.substring(287,289)); //c.addAttribute("CODIGO DEL MUNICIPIO DE ORIGEN EN CASO DE AGREGACION",line.substring(289,292)); From 20d793d6fa373e1b8cdbe98a5a4571a93088424e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mar=C3=ADn?= Date: Tue, 20 Mar 2012 23:17:44 +0100 Subject: [PATCH 4/5] Haciendo que los usos de los edificios se calculen despues de los usos de las parcelas --- src/Cat2Osm.java | 94 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 73 insertions(+), 21 deletions(-) diff --git a/src/Cat2Osm.java b/src/Cat2Osm.java index 1dfc165..c08a392 100644 --- a/src/Cat2Osm.java +++ b/src/Cat2Osm.java @@ -170,12 +170,51 @@ public List calcularPortales(List shapes){ */ public List calcularUsos(List shapes){ + // Creamos los tags que se van a aplicar sólo a los edificios de la parcela + Map> tagsBuildingMap = new HashMap (); + for (Shape shape : shapes) if (shape != (null) && shape instanceof ShapeParcela){ RelationOsm r = ((RelationOsm) utils.getKeyFromValue((Map) ((Object) utils.getTotalRelations()), shape.getRelationId())); - if (r != null) - r.addTags(destinoParser(((ShapeParcela)shape).getUsoMasArea())); + if (r != null) { + List tags = destinoParser(((ShapeParcela)shape).getUsoMasArea()); + + tagsBuilding = new ArrayList(); + + // Determinamos los tags exclusivos de los edificios + // y los borramos de los tags de la parcela + Iterator iter = tags.iterator(); + while (iter.hasNext()) { + tag = iter.next(); + if (tag[0].startsWith("@")) { + s = new String[2]; + s[0] = tag[0].replace("@", ""); + s[1] = tag[1]; + tagsBuilding.add(s); + iter.remove(); + } + } + + r.addTags(tags); + tagsBuildingMap.put (shape.getRefCat(), tagsBuilding); + + } + + + } + + System.out.println("["+new Timestamp(new Date().getTime())+"] Calculando usos de los edificios."); + for (Shape shape2: shapes) { + if (shape2 != (null) && shape2 instanceof ShapeConstru) { + if (tagsBuildingMap.containsKey(shape2.getRefCat())) { + RelationOsm r2 = ((RelationOsm) utils.getKeyFromValue((Map) ((Object) utils.getTotalRelations()), shape2.getRelationId())); + r2.addTags(tagsBuildingMap.get(shape2.getRefCat())); + } } + } + + + return shapes; } @@ -610,12 +649,23 @@ public void catUsosParser(File cat, List shapesTotales) throws IOExceptio // Cogemos la geometria exterior de la parcela Geometry geom = (LineString) shape.getPoligons().get(0); - + // Creamos los tags que tendra el nodo List tags = new ArrayList(); - + // Metemos los tags de uso de inmuebles con el numero de inmueble por delante tags.addAll(destinoParser(line.substring(70,73).trim())); + + // Determinamos los tags exclusivos de los edificios + // y los borramos de los tags, ya que no son aplicables a nodos + Iterator iter = tags.iterator(); + while (iter.hasNext()) { + tag = iter.next(); + if (tag[0].startsWith("@")) { + iter.remove(); + } + } + for (String[] tag : tags){ tag[0] = tag[0].replace("*", ""); } @@ -624,6 +674,7 @@ public void catUsosParser(File cat, List shapesTotales) throws IOExceptio tags.add(new String[] {"catastro:ref", line.substring(30,44) + line.substring(44,48)}); tags.add(new String[] {"addr:floor", line.substring(64,67).trim() }); + // Creamos el nodo en la lista de nodos de utils, pero no se lo anadimos al shape sino luego // lo borraria ya que eliminamos todos los nodos que sean de geometrias de shape @@ -1227,6 +1278,7 @@ public static List usoInmueblesParser(String codigo){ * por delante cuando son tipos genericos sin especificaciones, * comprueba que no exista ese tag antes de meterlo. En caso de existir * dejaria el que ya estaba. + * Si al tag le ponemos un '@', sólo aplica a aquellos shapes que sean edificios. * @param codigo Codigo de uso de inmueble * @return Lista de tags que genera */ @@ -1241,7 +1293,7 @@ public static List destinoParser(String codigo){ case "AAL": case "BAL": - s[0] = "building"; s[1] = "warehouse"; + s[0] = "@building"; s[1] = "warehouse"; l.add(s); return l; @@ -1256,13 +1308,13 @@ public static List destinoParser(String codigo){ case"ACR": case"BCR": - s[0] = "building"; s[1] = "yes"; + s[0] = "@building"; s[1] = "yes"; l.add(s); return l; case "ACT": case "BCT": - s[0] = "building"; s[1] = "yes"; + s[0] = "@building"; s[1] = "yes"; l.add(s); s = new String[2]; s[0] = "power"; s[1] = "sub_station"; @@ -1271,7 +1323,7 @@ public static List destinoParser(String codigo){ case "AES": case "BES": - s[0] = "building"; s[1] = "yes"; + s[0] = "@building"; s[1] = "yes"; l.add(s); s = new String[2]; s[0] = "public_transport"; s[1] = "station"; @@ -1280,7 +1332,7 @@ public static List destinoParser(String codigo){ case "AIG": case "BIG": - s[0] = "building"; s[1] = "livestock"; + s[0] = "@building"; s[1] = "livestock"; l.add(s); s = new String[2]; s[0] = "landuse"; s[1] = "farmyard"; @@ -2277,7 +2329,7 @@ public static List destinoParser(String codigo){ s[0] = "amenity"; s[1] = "townhall"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2289,7 +2341,7 @@ public static List destinoParser(String codigo){ s[0] = "operator"; s[1] = "autonomous_community"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2298,7 +2350,7 @@ public static List destinoParser(String codigo){ s[0] = "amenity"; s[1] = "townhall"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2307,7 +2359,7 @@ public static List destinoParser(String codigo){ s[0] = "office"; s[1] = "administrative"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2318,7 +2370,7 @@ public static List destinoParser(String codigo){ s[0] = "office"; s[1] = "government"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2330,7 +2382,7 @@ public static List destinoParser(String codigo){ s[0] = "operator"; s[1] = "county"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2342,7 +2394,7 @@ public static List destinoParser(String codigo){ s[0] = "operator"; s[1] = "province"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "public"; + s[0] = "@building"; s[1] = "public"; l.add(s); return l; @@ -2363,7 +2415,7 @@ public static List destinoParser(String codigo){ s[0] = "denomination"; s[1] = "catholic"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "basilica"; + s[0] = "@building"; s[1] = "basilica"; l.add(s); return l; @@ -2378,7 +2430,7 @@ public static List destinoParser(String codigo){ s[0] = "denomination"; s[1] = "catholic"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "chapel"; + s[0] = "@building"; s[1] = "chapel"; l.add(s); return l; @@ -2393,7 +2445,7 @@ public static List destinoParser(String codigo){ s[0] = "denomination"; s[1] = "catholic"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "cathedral"; + s[0] = "@building"; s[1] = "cathedral"; l.add(s); return l; @@ -2408,7 +2460,7 @@ public static List destinoParser(String codigo){ s[0] = "denomination"; s[1] = "catholic"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "hermitage"; + s[0] = "@building"; s[1] = "hermitage"; l.add(s); return l; @@ -2423,7 +2475,7 @@ public static List destinoParser(String codigo){ s[0] = "denomination"; s[1] = "catholic"; l.add(s); s = new String[2]; - s[0] = "building"; s[1] = "parish_church"; + s[0] = "@building"; s[1] = "parish_church"; l.add(s); return l; From 9de1f08bd6a0d4f6c1b7326804c4540551029dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mar=C3=ADn?= Date: Tue, 20 Mar 2012 23:50:12 +0100 Subject: [PATCH 5/5] =?UTF-8?q?Haciendo=20que=20los=20multipol=C3=ADgonos?= =?UTF-8?q?=20sin=20datos=20(es=20decir,=20aquellos=20con=20solo=20source?= =?UTF-8?q?=3Dcatastro=20y=20source:date=3DXX)=20no=20se=20impriman.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/RelationOsm.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/RelationOsm.java b/src/RelationOsm.java index b95948a..0a09e3e 100644 --- a/src/RelationOsm.java +++ b/src/RelationOsm.java @@ -299,17 +299,25 @@ else if (tags.get(x)[0].equals("CAT2OSMSHAPEID") && Config.get("PrintShapeIds"). // En caso de que tenga varios ways, si que se imprime como una relacion de ways. else { + + boolean with_data=false; + s = ("\n"); for (int x = 0; x < ids.size(); x++) if (utils.getTotalWays().containsValue(ids.get(x))) - s += ("\n"); + s += ("\n"); for (int x = 0; x < tags.size(); x++){ // Filtramos para que no salgan todos los tags, abajo se explica el porque - if (!tags.get(x)[0].equals("addr:housenumber") && !tags.get(x)[0].equals("addr:postcode") && !tags.get(x)[0].equals("addr:country") && !tags.get(x)[0].equals("addr:street") && !tags.get(x)[0].equals("addr:full") && !tags.get(x)[0].equals("CAT2OSMSHAPEID")) + if (!tags.get(x)[0].equals("addr:housenumber") && !tags.get(x)[0].equals("addr:postcode") && !tags.get(x)[0].equals("addr:country") && !tags.get(x)[0].equals("addr:street") && !tags.get(x)[0].equals("addr:full") && !tags.get(x)[0].equals("CAT2OSMSHAPEID")) { + + if (!with_data && !tags.get(x)[0].equals("source") && !tags.get(x)[0].equals("source:date")) + with_data = true; + s += "\n"; + } // El tag addr:housenumber, addr:street, addr:full, addr:postcode y addr:country // solo se puede asignar a parcelas. Por eso habra @@ -317,8 +325,10 @@ else if (tags.get(x)[0].equals("CAT2OSMSHAPEID") && Config.get("PrintShapeIds"). // shapeParcela else if (tags.get(x)[0].equals("addr:housenumber") || tags.get(x)[0].equals("addr:postcode") || tags.get(x)[0].equals("addr:country") || tags.get(x)[0].equals("addr:street") || tags.get(x)[0].equals("addr:full")){ for (String[] tag : tags) - if (tag[0].equals("CAT2OSMSHAPEID") && tag[1].startsWith("PARCELA")) + if (tag[0].equals("CAT2OSMSHAPEID") && tag[1].startsWith("PARCELA")) { + with_data = true; s += "\n"; + } } // Mostrar los shapes que utilizan esta relacion, para debugging @@ -332,6 +342,9 @@ else if (tags.get(x)[0].contains("CAT2OSMSHAPEID") && Config.get("PrintShapeIds" s += "\n"; s += ("\n"); + + if (! with_data) + s = ""; } return s;