Changeset 28554 in osm for applications/editors/josm/plugins/opendata/modules/fr.toulouse/src
- Timestamp:
- 2012-08-16T01:28:42+02:00 (12 years ago)
- Location:
- applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse
- Files:
-
- 1 added
- 43 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseConstants.java
r28113 r28554 20 20 21 21 public interface ToulouseConstants extends FrenchConstants { 22 23 24 25 26 27 28 29 30 31 32 22 23 /** 24 * Sources 25 */ 26 public static final String SOURCE_GRAND_TOULOUSE = "GrandToulouse"; 27 public static final String SOURCE_TISSEO = "Tisséo SMTC"; 28 29 /** 30 * Wiki 31 */ 32 public static final String WIKI = "http://wiki.openstreetmap.org/wiki/Toulouse/GrandToulouseData"; 33 33 34 35 36 37 34 /** 35 * Portal 36 */ 37 public static final String PORTAL = "http://data.grandtoulouse.fr"; 38 38 39 40 41 42 43 39 /** 40 * Icons 41 */ 42 public static final String ICON_CROIX_16 = "data.fr.toulouse_16.png"; 43 public static final String ICON_CROIX_24 = "data.fr.toulouse_24.png"; 44 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 45 /** 46 * NEPTUNE XML Schema modified to accept Tisséo files 47 */ 48 public static final String TOULOUSE_NEPTUNE_XSD = "/neptune_toulouse/neptune.xsd"; 49 50 /** 51 * Categories: TODO: icons 52 */ 53 public static final DataSetCategory CAT_ASSOCIATIONS = new DataSetCategory("Associations", ""); 54 public static final DataSetCategory CAT_CITOYENNETE = new DataSetCategory("Citoyenneté", ""); 55 public static final DataSetCategory CAT_CULTURE = new DataSetCategory("Culture", ""); 56 public static final DataSetCategory CAT_ENFANCE = new DataSetCategory("Enfance", ""); 57 public static final DataSetCategory CAT_ENVIRONNEMENT = new DataSetCategory("Environnement", ""); 58 public static final DataSetCategory CAT_PATRIMOINE = new DataSetCategory("Patrimoine", ""); 59 public static final DataSetCategory CAT_SPORT = new DataSetCategory("Sport", ""); 60 public static final DataSetCategory CAT_TOPOGRAPHIE = new DataSetCategory("Topographie", ""); 61 public static final DataSetCategory CAT_TRANSPORT = new DataSetCategory("Transport", ""); 62 public static final DataSetCategory CAT_URBANISME = new DataSetCategory("Urbanisme", ""); 63 63 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseLicense.java
r28113 r28554 20 20 public class ToulouseLicense extends ODbL implements ToulouseConstants { 21 21 22 23 24 25 26 27 28 29 22 public ToulouseLicense() { 23 // TODO: Toulouse license 24 /*try { 25 setURL(PORTAL + "/la-licence", "fr"); 26 } catch (MalformedURLException e) { 27 e.printStackTrace(); 28 }*/ 29 } 30 30 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/ToulouseModule.java
r28143 r28554 41 41 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.patrimoine.Parcelles1830Handler; 42 42 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.sport.InstallationSportiveBalmaHandler; 43 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.sport.InstallationSportiveToulouseHandler; 43 44 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.topographie.AltimetrieVoieHandler; 44 45 import org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.transport.ChantiersLineairesHandler; … … 59 60 public class ToulouseModule extends AbstractModule { 60 61 61 62 62 public ToulouseModule(ModuleInformation info) { 63 super(info); 63 64 handlers.add(SanisetteHandler.class); 64 65 handlers.add(NumerosRueHandler.class); … … 99 100 handlers.add(ChantiersPonctuelsHandler.class); 100 101 handlers.add(ChantiersLineairesHandler.class); 102 handlers.add(InstallationSportiveToulouseHandler.class); 101 103 } 102 104 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/ToulouseDataSetHandler.java
r28113 r28554 24 24 25 25 public abstract class ToulouseDataSetHandler extends FrenchDataSetHandler implements ToulouseConstants { 26 27 28 29 30 31 32 33 34 35 36 37 38 39 26 27 public ToulouseDataSetHandler(int portalId) { 28 init(portalId); 29 } 30 31 public ToulouseDataSetHandler(int portalId, String relevantTag) { 32 super(relevantTag); 33 init(portalId); 34 } 35 36 public ToulouseDataSetHandler(int portalId, boolean relevantUnion, String ... relevantTags) { 37 super(relevantUnion, relevantTags); 38 init(portalId); 39 } 40 40 41 42 43 41 public ToulouseDataSetHandler(int portalId, String ... relevantTags) { 42 this(portalId, false, relevantTags); 43 } 44 44 45 46 47 48 49 50 51 52 53 45 /*public ToulouseDataSetHandler(int portalId, Tag relevantTag) { 46 super(relevantTag); 47 init(portalId); 48 }*/ 49 50 public ToulouseDataSetHandler(int portalId, boolean relevantUnion, Tag ... relevantTags) { 51 super(relevantUnion, relevantTags); 52 init(portalId); 53 } 54 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 55 /*public ToulouseDataSetHandler(int portalId, Tag ... relevantTags) { 56 this(portalId, false, relevantTags); 57 }*/ 58 59 private final void init(int portalId) { 60 try { 61 setLicense(new ToulouseLicense()); 62 if (portalId > 0) { 63 String url = PORTAL + "/les-donnees/-/opendata/card/" + portalId + "--"; 64 setLocalPortalURL(url); 65 //setLicenseURL(url+"/license"); 66 setDataURL(url+"/resource/document"); 67 } 68 } catch (MalformedURLException e) { 69 e.printStackTrace(); 70 } 71 } 72 72 73 74 75 76 77 78 79 73 /* (non-Javadoc) 74 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#getSource() 75 */ 76 @Override 77 public String getSource() { 78 return SOURCE_GRAND_TOULOUSE; 79 } 80 80 81 82 83 84 85 86 87 81 /* (non-Javadoc) 82 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#getLocalPortalIconName() 83 */ 84 @Override 85 public String getLocalPortalIconName() { 86 return ICON_CROIX_24; 87 } 88 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 89 /* (non-Javadoc) 90 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#getDataLayerIconName() 91 */ 92 @Override 93 public String getDataLayerIconName() { 94 return ICON_CROIX_16; 95 } 96 97 protected final void setWikiPage(String wikiPage) { 98 if (wikiPage != null && !wikiPage.isEmpty()) { 99 setName(wikiPage.replace("_", " ")); 100 try { 101 setWikiURL(WIKI + "/" + wikiPage.replace(" ", "_")); 102 } catch (MalformedURLException e) { 103 e.printStackTrace(); 104 } 105 } 106 } 107 107 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/associations/Club3eAgeHandler.java
r28044 r28554 16 16 package org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.associations; 17 17 18 import org.apache.commons.lang3.text.WordUtils; 18 19 import org.openstreetmap.josm.data.osm.DataSet; 19 20 import org.openstreetmap.josm.data.osm.Node; … … 22 23 public class Club3eAgeHandler extends ToulouseDataSetHandler { 23 24 24 25 super(12587, "leisure=club", "club=elderly");26 27 28 29 30 31 32 33 25 public Club3eAgeHandler() { 26 super(12587, "social_facility=outreach", "social_facility:for=senior"); 27 setWikiPage("Clubs du 3ème âge"); 28 setCategory(CAT_ASSOCIATIONS); 29 } 30 31 @Override 32 public boolean acceptsFilename(String filename) { 33 return acceptsCsvKmzTabFilename(filename, "Club_3E_AGE"); 34 } 34 35 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 replace(n, "Nom", "name"); 39 n.put("leisure", "club"); 40 n.put("club", "elderly"); 41 } 42 } 36 @Override 37 public void updateDataSet(DataSet ds) { 38 for (Node n : ds.getNodes()) { 39 replace(n, "Nom", "name"); 40 n.put("name", WordUtils.capitalizeFully(n.get("name"))); 41 n.put("social_facility", "outreach"); 42 n.put("social_facility:for", "senior"); 43 n.remove("Adresse"); 44 n.remove("CP"); 45 n.remove("Classe"); 46 n.remove("CodSTI"); 47 n.remove("Description"); 48 n.remove("Numero"); 49 n.remove("Ville"); 50 n.remove("color"); 51 } 52 } 43 53 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/BureauxVoteHandler.java
r28044 r28554 22 22 public class BureauxVoteHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public BureauxVoteHandler() { 25 super(12550, "polling_station"); 26 setWikiPage("Bureaux de vote 2012"); 27 setCategory(CAT_CITOYENNETE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Lieu_vote_2012"); 33 } 34 34 35 36 37 38 39 40 41 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 replace(r, "TEXT", "name"); 39 r.put("polling_station", "2012"); 40 } 41 } 42 42 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/MairieAnnexeHandler.java
r28044 r28554 21 21 22 22 public class MairieAnnexeHandler extends MairieHandler { 23 24 25 26 27 23 24 public MairieAnnexeHandler() { 25 super(12560, "Mairies annexes"); 26 setCategory(CAT_CITOYENNETE); 27 } 28 28 29 30 31 32 29 @Override 30 public boolean acceptsFilename(String filename) { 31 return acceptsCsvKmzTabFilename(filename, "Mairie_Annexe"); 32 } 33 33 34 35 36 37 38 39 40 41 42 43 44 34 /* (non-Javadoc) 35 * @see org.openstreetmap.josm.plugins.opendata.portals.fr.toulouse.datasets.citoyennete.MairieHandler#updateDataSet(org.openstreetmap.josm.data.osm.DataSet) 36 */ 37 @Override 38 public void updateDataSet(DataSet ds) { 39 super.updateDataSet(ds); 40 for (Node n : ds.getNodes()) { 41 replaceFax(n, "Fax"); 42 n.remove("Num"); 43 } 44 } 45 45 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/MairieHandler.java
r28044 r28554 22 22 public class MairieHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 29 30 31 32 24 public MairieHandler() { 25 this(12554, "Mairies"); 26 setCategory(CAT_CITOYENNETE); 27 } 28 29 protected MairieHandler(int portalId, String wikiPage) { 30 super(portalId, "amenity=townhall"); 31 setWikiPage(wikiPage); 32 } 33 33 34 35 36 37 34 @Override 35 public boolean acceptsFilename(String filename) { 36 return acceptsCsvKmzTabFilename(filename, "Mairie"); 37 } 38 38 39 40 41 42 43 44 45 46 47 48 49 50 39 @Override 40 public void updateDataSet(DataSet ds) { 41 for (Node n : ds.getNodes()) { 42 replace(n, "Mairie", "name"); 43 n.put("amenity", "townhall"); 44 replaceOpeningHours(n, "Horaire_ouverture"); 45 n.remove("INSEE"); 46 n.remove("Libelle"); 47 replacePhone(n, "Telephone"); 48 n.remove("Type"); 49 } 50 } 51 51 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/PolesTerritoriauxHandler.java
r28044 r28554 22 22 public class PolesTerritoriauxHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public PolesTerritoriauxHandler() { 25 super(12568); 26 setName("Pôles territoriaux "); 27 setCategory(CAT_CITOYENNETE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Poles_territoriaux"); 33 } 34 34 35 36 37 38 39 40 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 replace(r, "Nom_pole", "name"); 39 } 40 } 41 41 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/QuartiersHandler.java
r28044 r28554 22 22 public class QuartiersHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public QuartiersHandler() { 25 super(12574, "admin_level=11"); 26 setWikiPage("Quartiers de proximité"); 27 setCategory(CAT_CITOYENNETE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Quartiers"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 r.remove("name"); 39 replace(r, "Quartier", "ref"); 40 replace(r, "Nom_Quartier", "description"); 41 r.put("type", "boundary"); 42 r.put("boundary", "administrative"); 43 r.put("admin_level", "11"); 44 r.remove("Adjoint_Secteur"); 45 r.remove("Elu_Referent_Quartier"); 46 r.remove("Id"); 47 r.remove("Nom_Secteur"); 48 r.remove("Secteur"); 49 } 50 } 51 51 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/citoyennete/SecteursHandler.java
r28044 r28554 22 22 public class SecteursHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public SecteursHandler() { 25 super(12580, "admin_level=10"); 26 setWikiPage("Secteurs de proximité"); 27 setCategory(CAT_CITOYENNETE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Secteurs"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 r.remove("name"); 39 replace(r, "Secteur", "ref"); 40 replace(r, "Nom_Secteur", "description"); 41 r.put("type", "boundary"); 42 r.put("boundary", "administrative"); 43 r.put("admin_level", "10"); 44 r.remove("Adjoint_Secteur"); 45 r.remove("Charge_de_Secteur"); 46 } 47 } 48 48 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/culture/BibliothequesHandler.java
r28044 r28554 22 22 public class BibliothequesHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public BibliothequesHandler() { 25 super(12402, "amenity=library"); 26 setWikiPage("Médiathèques, bibliothèques et bibliobus"); 27 setCategory(CAT_CULTURE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Bibliotheques"); 33 } 34 34 35 36 37 38 39 40 41 42 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 replace(n, "Nom", "name"); 39 replace(n, "Site_Internet", "website"); 40 n.put("amenity", "library"); 41 } 42 } 43 43 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/culture/EquipementCulturelBalmaHandler.java
r28044 r28554 22 22 public class EquipementCulturelBalmaHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public EquipementCulturelBalmaHandler() { 25 super(13997); 26 setWikiPage("Équipements Culturels"); 27 setCategory(CAT_CULTURE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzFilename(filename, "culture"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 if (n.get("name").equalsIgnoreCase("Bibliothèque")) { 39 n.put("amenity", "library"); 40 } else if (n.get("name").equalsIgnoreCase("Auditorium")) { 41 n.put("amenity", "auditorium"); 42 } 43 } 44 } 45 45 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/culture/LudothequeHandler.java
r28044 r28554 22 22 public class LudothequeHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 29 30 31 32 33 24 public LudothequeHandler() { 25 super(12420, "amenity=toy_library"); 26 setWikiPage("Ludothèques"); 27 setCategory(CAT_CULTURE); 28 } 29 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Ludotheques"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 replace(n, "NOM", "name"); 39 n.put("amenity", "toy_library"); 40 n.remove("ADRESSE"); 41 n.remove("CP"); 42 n.remove("INSEE"); 43 n.remove("NATURE"); 44 n.remove("NUM"); 45 n.remove("QUARTIER"); 46 n.remove("STIADR"); 47 } 48 } 49 49 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/culture/MuseeHandler.java
r28044 r28554 23 23 public class MuseeHandler extends ToulouseDataSetHandler { 24 24 25 26 27 28 29 25 public MuseeHandler() { 26 super(12426, "tourism=museum"); 27 setWikiPage("Musées"); 28 setCategory(CAT_CULTURE); 29 } 30 30 31 32 33 34 31 @Override 32 public boolean acceptsFilename(String filename) { 33 return acceptsCsvKmzTabFilename(filename, "Musee"); 34 } 35 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 36 @Override 37 public void updateDataSet(DataSet ds) { 38 for (Node n : ds.getNodes()) { 39 replace(n, "NOMS", "name"); 40 replace(n, "SITE_INTERNET", "contact:website"); 41 n.put("tourism", "museum"); 42 n.remove("ADRESSES"); 43 n.remove("Num"); 44 n.remove("Index"); 45 replacePhone(n, "TELEPHONE"); 46 String name = WordUtils.capitalizeFully(n.get("name")).replace("Musee", "Musée").replace(" D ", " d'").replace(" L ", " l'").trim(); 47 int index = name.indexOf("Musée"); 48 if (index > 1) { 49 name = name.substring(index) + " " + name.substring(0, index-1); 50 } 51 while (name.contains(" ")) { 52 name = name.replace(" ", " "); 53 } 54 n.put("name", name); 55 } 56 } 57 57 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/culture/TheatreHandler.java
r28044 r28554 22 22 public class TheatreHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public TheatreHandler() { 25 super(12448, "amenity=theatre"); 26 setWikiPage("Théâtres"); 27 setCategory(CAT_CULTURE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Theatre"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 replace(n, "NOMS", "name"); 39 replace(n, "Site_Internet", "contact:website"); 40 n.put("amenity", "theatre"); 41 n.remove("ADRESSES"); 42 n.remove("Description"); 43 n.remove("Index"); 44 n.remove("NUM"); 45 replacePhone(n, "Telephone"); 46 String type = n.get("Type"); 47 if (type != null) { 48 if (type.equals("MUNICIPAL")) { 49 n.put("operator", "Mairie de Toulouse"); 50 } 51 n.remove("Type"); 52 } 53 } 54 } 55 55 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/CrechesHandler.java
r28044 r28554 22 22 public class CrechesHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public CrechesHandler() { 25 super(12462, "amenity=kindergarten"); 26 setWikiPage("Crèches"); 27 setCategory(CAT_ENFANCE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Creches"); 33 } 34 34 35 36 37 38 39 40 41 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.put("amenity", "kindergarten"); 39 replace(n, "NOM", "name"); 40 } 41 } 42 42 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/EcoleBalmaHandler.java
r28044 r28554 22 22 public class EcoleBalmaHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public EcoleBalmaHandler() { 25 super(13993, "amenity=school"); 26 setWikiPage("Écoles"); 27 setCategory(CAT_ENFANCE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzFilename(filename, "Ecoles"); 33 } 34 34 35 36 37 38 39 40 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.put("amenity", "school"); 39 } 40 } 41 41 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/EcoleElementaireHandler.java
r28044 r28554 22 22 public class EcoleElementaireHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 29 30 31 24 public EcoleElementaireHandler() { 25 super(12474, "amenity=school"); 26 setWikiPage("Écoles élémentaires publiques"); 27 setCategory(CAT_ENFANCE); 28 for (String forbidden : new String[]{"maternelle","primaire","collège","lycée","secondaire"}) { 29 addForbiddenTag("school:FR="+forbidden); 30 } 31 } 32 32 33 34 35 36 33 @Override 34 public boolean acceptsFilename(String filename) { 35 return acceptsCsvKmzTabFilename(filename, "Ecoles_Elem_Publiques"); 36 } 37 37 38 39 40 41 42 43 44 45 46 38 @Override 39 public void updateDataSet(DataSet ds) { 40 for (Node n : ds.getNodes()) { 41 n.put("amenity", "school"); 42 n.put("school:FR", "elementaire"); 43 n.put("operator", "public"); 44 replace(n, "Ecole", "name"); 45 } 46 } 47 47 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/EcoleMaternelleHandler.java
r28044 r28554 22 22 public class EcoleMaternelleHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 29 30 31 24 public EcoleMaternelleHandler() { 25 super(12490, "amenity=school"); 26 setWikiPage("Écoles maternelles publiques"); 27 setCategory(CAT_ENFANCE); 28 for (String forbidden : new String[]{"élémentaire","primaire","collège","lycée","secondaire"}) { 29 addForbiddenTag("school:FR="+forbidden); 30 } 31 } 32 32 33 34 35 36 33 @Override 34 public boolean acceptsFilename(String filename) { 35 return acceptsCsvKmzTabFilename(filename, "Ecoles_Mat_Publiques"); 36 } 37 37 38 39 40 41 42 43 44 45 46 38 @Override 39 public void updateDataSet(DataSet ds) { 40 for (Node n : ds.getNodes()) { 41 n.put("amenity", "school"); 42 n.put("school:FR", "maternelle"); 43 n.put("operator", "public"); 44 replace(n, "Ecole", "name"); 45 } 46 } 47 47 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/enfance/PetiteEnfanceEtJeunesseBalmaHandler.java
r28044 r28554 22 22 public class PetiteEnfanceEtJeunesseBalmaHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public PetiteEnfanceEtJeunesseBalmaHandler() { 25 super(14001); 26 setWikiPage("Petite enfance et jeunesse"); 27 setCategory(CAT_ENFANCE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzFilename(filename, "Petite enfance et jeunesse"); 33 } 34 34 35 36 37 38 39 40 41 42 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 if (n.get("name").equalsIgnoreCase("Crèche")) { 39 n.put("amenity", "kindergarten"); 40 } 41 } 42 } 43 43 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/environnement/RecupEmballageHandler.java
r28044 r28554 22 22 public class RecupEmballageHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public RecupEmballageHandler() { 25 super(12494, "amenity=recycling"); 26 setWikiPage("Récup' Emballage"); 27 setCategory(CAT_ENVIRONNEMENT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Recup_Emballage"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.remove("name"); 39 n.put("amenity", "recycling"); 40 n.put("recycling_type", "container"); 41 n.put("recycling:plastic_bottles", "yes"); 42 n.put("recycling:beverage_cartons", "yes"); 43 n.put("recycling:cardboard", "yes"); 44 n.put("recycling:newspaper", "yes"); 45 n.put("recycling:magazines", "yes"); 46 } 47 } 48 48 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/environnement/RecupVerreHandler.java
r28044 r28554 22 22 public class RecupVerreHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public RecupVerreHandler() { 25 super(12496, "amenity=recycling"); 26 setWikiPage("Récup' Verre"); 27 setCategory(CAT_ENVIRONNEMENT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Recup_Verre"); 33 } 34 34 35 36 37 38 39 40 41 42 43 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.remove("name"); 39 n.put("amenity", "recycling"); 40 n.put("recycling:glass", "no"); 41 n.put("recycling:glass_bottles", "yes"); 42 } 43 } 44 44 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/environnement/StationEpurationHandler.java
r28044 r28554 22 22 public class StationEpurationHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public StationEpurationHandler() { 25 super(12500, "man_made=wastewater_plant"); 26 setWikiPage("Stations d'épuration"); 27 setCategory(CAT_ENVIRONNEMENT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Stations_epurations"); 33 } 34 34 35 36 37 38 39 40 41 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 replace(n, "NOM_STATION", "name"); 39 n.put("man_made", "wastewater_plant"); 40 } 41 } 42 42 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/patrimoine/Parcelles1680Handler.java
r28044 r28554 22 22 public class Parcelles1680Handler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public Parcelles1680Handler() { 25 super(12514); 26 setName("Parcellaire de 1680"); 27 setCategory(CAT_PATRIMOINE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Parcelles_1680"); 33 } 34 34 35 36 37 38 39 40 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 replace(r, "Nom_prenom", "name"); 39 } 40 } 41 41 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/patrimoine/Parcelles1830Handler.java
r28044 r28554 22 22 public class Parcelles1830Handler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public Parcelles1830Handler() { 25 super(12534); 26 setName("Parcellaire de 1830"); 27 setCategory(CAT_PATRIMOINE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Parcelles_1830"); 33 } 34 34 35 36 37 38 39 40 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 replace(r, "Nom_prenom", "name"); 39 } 40 } 41 41 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/sport/InstallationSportiveBalmaHandler.java
r28044 r28554 22 22 public class InstallationSportiveBalmaHandler extends ToulouseDataSetHandler { 23 23 24 25 26 setWikiPage("Installations sportives");27 28 24 public InstallationSportiveBalmaHandler() { 25 super(14010); 26 setWikiPage("Installations sportives (Balma)"); 27 setCategory(CAT_SPORT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzFilename(filename, "Sports"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 if (n.get("name").startsWith("Gymnase")) { 39 n.put("leisure", "sports_centre"); 40 } else if (n.get("name").startsWith("Piscine")) { 41 n.put("leisure", "swimming_pool"); 42 n.put("sport", "swimming"); 43 } else if (n.get("name").startsWith("Skate")) { 44 n.put("leisure", "skate_park"); 45 n.put("sport", "skateboard"); 46 } else if (n.get("name").startsWith("Tennis")) { 47 n.put("leisure", "pitch"); 48 n.put("sport", "tennis"); 49 } else if (n.get("name").startsWith("Stade")) { 50 n.put("leisure", "pitch"); 51 } else if (n.get("name").startsWith("Dojo")) { 52 n.put("amenity", "dojo"); 53 } else if (n.get("name").startsWith("Boulodrome")) { 54 n.put("sport", "boules"); 55 } 56 } 57 } 58 58 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/topographie/AltimetrieVoieHandler.java
r28057 r28554 21 21 22 22 public class AltimetrieVoieHandler extends ToulouseDataSetHandler { 23 24 25 26 27 28 23 24 public AltimetrieVoieHandler() { 25 super(12660, "ele"); 26 setName("Altimétrie des voies"); 27 setCategory(CAT_TOPOGRAPHIE); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "XYZ_PT_ALTI_VOIES"); 33 } 34 34 35 36 37 38 39 40 41 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 replace(n, "Altimetrie", "ele"); 39 n.put("name", n.get("ele")); // name pour voir la hauteur directement (hack, FIXME) 40 } 41 } 42 42 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ChantiersHandler.java
r28096 r28554 22 22 public abstract class ChantiersHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 24 public ChantiersHandler(int portalId, String name) { 25 super(portalId, "highway=construction"); 26 setWikiPage("Chantiers en cours"); 27 setName(name); 28 setCategory(CAT_TRANSPORT); 29 } 30 31 @Override 32 public void updateDataSet(DataSet ds) { 33 for (OsmPrimitive p : ds.allPrimitives()) { 34 if (p.hasKeys()) { 35 p.put("highway", "construction"); 36 p.remove("name"); 37 p.remove("color"); 38 replace(p, "Lien", "website"); 39 } 40 } 41 } 42 42 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ChantiersLineairesHandler.java
r28096 r28554 19 19 public class ChantiersLineairesHandler extends ChantiersHandler { 20 20 21 22 23 21 public ChantiersLineairesHandler() { 22 super(14063, "Chantiers en cours (linéaire)"); 23 } 24 24 25 26 27 28 25 @Override 26 public boolean acceptsFilename(String filename) { 27 return acceptsKmzTabFilename(filename, "Chantiers_Lineaires"); 28 } 29 29 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ChantiersPonctuelsHandler.java
r28113 r28554 19 19 public class ChantiersPonctuelsHandler extends ChantiersHandler { 20 20 21 22 23 24 21 public ChantiersPonctuelsHandler() { 22 super(14071, "Chantiers en cours (ponctuel)"); 23 getCsvHandler().setCharset(ISO8859_15); 24 } 25 25 26 27 28 29 26 @Override 27 public boolean acceptsFilename(String filename) { 28 return acceptsCsvKmzTabFilename(filename, "Chantiers_Ponctuels"); 29 } 30 30 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/HorodateurHandler.java
r28044 r28554 26 26 public class HorodateurHandler extends ToulouseDataSetHandler { 27 27 28 29 30 31 32 28 public HorodateurHandler() { 29 super(12540, "vending=parking_tickets"); 30 setWikiPage("Horodateurs"); 31 setCategory(CAT_TRANSPORT); 32 } 33 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 34 @Override 35 public boolean acceptsFilename(String filename) { 36 return acceptsCsvKmzTabFilename(filename, "Horodateur"); 37 } 38 39 private String parseHour(String hour) { 40 String s = hour.replaceFirst("[hH]", ":"); 41 if (s.endsWith(":")) { 42 s += "00"; 43 } 44 return s; 45 } 46 47 protected String parseOpeningHours(String horaire) { 48 final String hour = "\\p{Digit}{1,2}[hH]\\p{Digit}{0,2}"; 49 final String sep = "[ -/]+"; 50 final String hours = "("+hour+sep+hour+")"; 51 final Pattern p = Pattern.compile(hours+"(?:"+sep+hours+")*"); 52 final Matcher m = p.matcher(horaire); 53 String opening_hours = ""; 54 if (m.matches()) { 55 for (int i = 1; i<=m.groupCount(); i++) { 56 if (m.group(i) != null) { 57 if (!opening_hours.isEmpty()) { 58 opening_hours += "; "; 59 } 60 final Pattern p2 = Pattern.compile("("+hour+")"+sep+"("+hour+")"); 61 final Matcher m2 = p2.matcher(m.group(i)); 62 if (m2.matches()) { 63 opening_hours += parseHour(m2.group(1)) + "-" + parseHour(m2.group(2)); 64 } else { 65 System.err.println(m.group(i)+" does not match "+p2); 66 } 67 } 68 } 69 } else { 70 System.err.println(horaire+" does not match "+p); 71 } 72 return opening_hours; 73 } 74 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 75 @Override 76 public void updateDataSet(DataSet ds) { 77 for (Node n : ds.getNodes()) { 78 n.put("amenity", "vending_machine"); 79 n.put("vending", "parking_tickets"); 80 n.remove("name"); 81 n.remove("Code_Insee"); 82 n.remove("Lib_voie"); 83 n.remove("Mot_dir"); 84 n.remove("No"); 85 n.remove("Reglementation"); 86 n.remove("color"); 87 replace(n, "commune", "operator", new ValueReplacer() { 88 @Override 89 public String replace(String value) { 90 return "Mairie de "+WordUtils.capitalizeFully(value); 91 } 92 }); 93 replace(n, "horaire", "opening_hours", new ValueReplacer() { 94 @Override 95 public String replace(String value) { 96 return parseOpeningHours(value); 97 } 98 }); 99 replace(n, "maj_date", "source:date", new ValueReplacer() { 100 @Override 101 public String replace(String value) { 102 return value.substring(0, 4)+"-"+value.substring(4, 6)+"-"+value.substring(6, 8); 103 } 104 }); 105 replace(n, "observations", "note"); 106 replace(n, "quartier_residant", "parking:ticket:zone", new ValueReplacer() { 107 @Override 108 public String replace(String value) { 109 return WordUtils.capitalizeFully(value.trim()) 110 .replace(" Iv", " IV").replace("Sebastopol", "Sébastopol") 111 .replace("St ", "Saint-").replace("Peri", "Péri"); 112 } 113 }); 114 } 115 } 116 116 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/MetroStationHandler.java
r28044 r28554 22 22 public class MetroStationHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public MetroStationHandler() { 25 super(12542, "subway=yes"); 26 setName("Stations de métro"); 27 setCategory(CAT_TRANSPORT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Metro_Station"); 33 } 34 34 35 36 37 38 39 40 41 42 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.put("public_transport", "stop_position"); 39 n.put("subway", "yes"); 40 replace(n, "NOM", "name"); 41 } 42 } 43 43 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/PMRHandler.java
r28044 r28554 22 22 public class PMRHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public PMRHandler() { 25 super(12538, "amenity=parking_space"); 26 setWikiPage("PMR"); 27 setCategory(CAT_TRANSPORT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Emplacements_PMR"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.remove("name"); 39 n.put("amenity", "parking_space"); 40 n.put("access:disabled", "designated"); 41 n.put("wheelchair", "designated"); 42 replace(n, "nb_places", "capacity:disabled"); 43 n.remove("Lib_voie"); 44 n.remove("No"); 45 n.remove("commune"); 46 n.remove("code_insee"); 47 n.remove("color"); 48 replace(n, "id_PMR", "ref:grandtoulouse"); 49 } 50 } 51 51 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/PistesCyclablesHandler.java
r28113 r28554 32 32 public class PistesCyclablesHandler extends ToulouseDataSetHandler { 33 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 34 protected final Map<String, Collection<String>> map = new HashMap<String, Collection<String>>(); 35 36 private String streetField; 37 38 public PistesCyclablesHandler() { 39 this("Nom_voie"); 40 setCategory(CAT_TRANSPORT); 41 } 42 43 public PistesCyclablesHandler(String streetField) { 44 super(12544, true, "cycleway", "cycleway:right", "cycleway:left", "cycleway:both", "highway=cycleway", "ramp:bicycle=yes", "bicycle=yes", "barrier=cycle_barrier"); 45 setWikiPage("Réseau cyclable et vert"); 46 addForbiddenTag("cycleway=no"); 47 this.streetField = streetField; 48 map.put("secondary", Arrays.asList(new String[] {"AVENUE", "Av ", "av ", "Avenue ", "avenue ", "BOULEVARD ", "bd ", "ALLEE", "Allee", "allee", 49 "PONT ", "Pont ", "PORT ", "ROUTE ", "Rte ", "BOULINGRIN", "boulingrin"})); 50 map.put("residential", Arrays.asList(new String[] {"CHEMIN ", "Chemin ", "chemin ", "IMPASSE ", "imp ", "PLACE ", "Place ", "place ", 51 "RUE ", "Rue ", "rue ", "QUAI", "VOIE ", "grand rue"})); 52 } 53 54 @Override 55 public boolean acceptsFilename(String filename) { 56 return acceptsKmzTabFilename(filename, "Pistes_Cyclables"); 57 } 58 59 /* (non-Javadoc) 60 * @see org.openstreetmap.josm.plugins.fr.opendata.datasets.SimpleDataSetHandler#getOverpassApiUnion(java.lang.String, java.lang.String[]) 61 */ 62 @Override 63 protected String getOverpassApiQueries(String bbox, String... conditions) { 64 return OverpassApi.query(bbox, NODE, conditions) + "\n" + 65 OverpassApi.recurse(NODE_RELATION, RELATION_WAY, WAY_NODE) + "\n" + 66 OverpassApi.query(bbox, WAY, conditions) + "\n" + 67 OverpassApi.recurse(WAY_NODE, "nodes") + "\n" + 68 OverpassApi.recurse(WAY_RELATION); 69 } 70 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 71 private String applyHighwayTag(String name, IPrimitive p) { 72 if (name != null && p != null) { 73 for (String key : map.keySet()) { 74 for (String value : map.get(key)) { 75 if (name.startsWith(value)) { 76 p.put("highway", key); 77 return key; 78 } 79 } 80 } 81 } 82 return null; 83 } 84 85 @Override 86 public void updateDataSet(DataSet ds) { 87 for (Way w : ds.getWays()) { 88 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 89 w.remove("name"); 90 91 String obs_type = w.get("obs_type"); 92 if (obs_type.equals("bande")) { 93 w.put("cycleway", "lane"); 94 } else if (obs_type.equals("bande a contresens") || obs_type.equals("contre allee")) { 95 w.put("cycleway", "opposite_lane"); 96 } else if (obs_type.equals("couloir bus")) { 97 w.put("cycleway", "share_busway"); 98 } else if (obs_type.equals("trottoir")) { 99 w.put("cycleway", "track"); 100 } else if (obs_type.equalsIgnoreCase("cheminement mixte") || obs_type.equals("reseau vert")) { 101 w.put("highway", "cycleway"); 102 w.put("foot", "yes"); 103 } else if (obs_type.equals("piste") || obs_type.equals("voie verte")) { 104 w.put("highway", "cycleway"); 105 } else if (obs_type.equals("zone 30")) { 106 w.put("zone:maxspeed", "FR:30"); 107 } else { 108 System.out.println(obs_type); 109 } 110 111 String name = w.get(streetField); 112 if (name != null) { 113 w.remove(streetField); 114 115 if (w.get("highway") == null && applyHighwayTag(name, w) == null) { 116 w.put("highway", "road"); 117 } 118 118 119 120 121 122 119 w.put("name", name); 120 } 121 } 122 } 123 123 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/ReseauTisseoHandler.java
r28113 r28554 27 27 public class ReseauTisseoHandler extends ToulouseDataSetHandler { 28 28 29 30 31 32 33 34 35 36 37 29 private static final URL neptuneSchemaUrl = ReseauTisseoHandler.class.getResource(TOULOUSE_NEPTUNE_XSD); 30 31 public ReseauTisseoHandler() { 32 super(14022, "network=fr_tisseo"); 33 NeptuneReader.registerSchema(neptuneSchemaUrl); 34 setName("Réseau Tisséo (Métro, Bus, Tram)"); 35 setCategory(CAT_TRANSPORT); 36 getZipHandler().setSkipXsdValidation(true); 37 } 38 38 39 40 41 42 43 44 45 46 47 48 49 50 39 @Override 40 public boolean acceptsFilename(String filename) { 41 return acceptsZipFilename(filename, "14022-reseau-tisseo-metro-bus-tram-") || filename.toLowerCase().endsWith(XML_EXT); 42 } 43 44 /* (non-Javadoc) 45 * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#acceptsFile(java.io.File) 46 */ 47 @Override 48 public boolean acceptsFile(File file) { 49 return acceptsFilename(file.getName()) && (file.getName().toLowerCase().endsWith(ZIP_EXT) || NeptuneReader.acceptsXmlNeptuneFile(file, neptuneSchemaUrl)); 50 } 51 51 52 53 54 55 56 57 58 52 /* (non-Javadoc) 53 * @see org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler#getSource() 54 */ 55 @Override 56 public String getSource() { 57 return SOURCE_TISSEO; 58 } 59 59 60 61 62 63 64 65 66 67 68 69 70 71 60 /* (non-Javadoc) 61 * @see org.openstreetmap.josm.plugins.opendata.modules.fr.toulouse.datasets.ToulouseDataSetHandler#getWikiURL() 62 */ 63 @Override 64 public URL getWikiURL() { 65 try { 66 return new URL("http://wiki.openstreetmap.org/wiki/Toulouse/Transports_en_commun#Réseau_Tisséo"); 67 } catch (MalformedURLException e) { 68 e.printStackTrace(); 69 } 70 return null; 71 } 72 72 73 74 75 76 77 78 79 73 @Override 74 public void updateDataSet(DataSet ds) { 75 for (OsmPrimitive p : ds.allPrimitives()) { 76 p.put("operator", "Tisséo"); 77 p.put("network", "fr_tisseo"); 78 } 79 } 80 80 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/TramwayStationHandler.java
r28044 r28554 22 22 public class TramwayStationHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public TramwayStationHandler() { 25 super(12611, "tram=yes"); 26 setName("Stations de tramway"); 27 setCategory(CAT_TRANSPORT); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Tramway_Stations"); 33 } 34 34 35 36 37 38 39 40 41 42 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.put("public_transport", "stop_position"); 39 n.put("tram", "yes"); 40 replace(n, "NOM", "name"); 41 } 42 } 43 43 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/VeloToulouseHandler.java
r28044 r28554 23 23 public class VeloToulouseHandler extends ToulouseDataSetHandler { 24 24 25 26 27 28 29 25 public VeloToulouseHandler() { 26 super(12546, "amenity=bicycle_rental"); 27 setWikiPage("Vélô Toulouse"); 28 setCategory(CAT_TRANSPORT); 29 } 30 30 31 32 33 34 31 @Override 32 public boolean acceptsFilename(String filename) { 33 return acceptsCsvKmzTabFilename(filename, "Velo_Toulouse"); 34 } 35 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 36 @Override 37 public void updateDataSet(DataSet ds) { 38 for (Node n : ds.getNodes()) { 39 n.put("amenity", "bicycle_rental"); 40 n.put("network", "VélôToulouse"); 41 n.put("operator", "JCDecaux"); 42 if (n.hasKey("M_en_S_16_nov_07") && n.get("M_en_S_16_nov_07").equals("O")) { 43 n.put("start_date", "2007-11-16"); 44 } 45 n.remove("M_en_S_16_nov_07"); 46 n.remove("Mot_Directeur"); 47 n.remove("No"); 48 n.remove("Nrivoli"); 49 n.remove("street"); 50 replace(n, "nb_bornettes", "capacity"); 51 replace(n, "num_station", "ref"); 52 replace(n, "nom", "name"); 53 n.put("name", WordUtils.capitalizeFully(n.get("name"))); 54 n.remove("code_insee"); 55 n.remove("commune"); 56 n.remove("color"); 57 if (n.hasKey("En_service") && n.get("En_service").equals("N")) { 58 n.put("fixme", "Station pas en service"); 59 } 60 n.remove("En_service"); 61 } 62 } 63 63 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/transport/Zone30Handler.java
r28044 r28554 21 21 22 22 public class Zone30Handler extends VoirieHandler { 23 24 25 26 27 28 23 24 public Zone30Handler() { 25 super(12548, "Street", "maxspeed=30"); 26 setWikiPage("Zones 30"); 27 setCategory(CAT_TRANSPORT); 28 } 29 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Zone30"); 33 } 34 35 @Override 36 public void updateDataSet(DataSet ds) { 37 super.updateDataSet(ds); 38 39 for (Way w : ds.getWays()) { 40 w.put("zone:maxspeed", "FR:30"); 41 w.put("maxspeed", "30"); 42 replace(w, "SensUnique", "oneway", new String[]{"oui", "non"}, new String[]{"yes", "no"}); 43 replace(w, "Annee", "start_date"); 44 replace(w, "Longueur", "length"); 45 w.remove("code_insee"); 46 w.remove("commune"); 47 w.remove("MotDir"); 48 } 49 } 50 50 51 52 53 54 55 56 57 51 /* (non-Javadoc) 52 * @see org.openstreetmap.josm.plugins.opendata.portals.fr.toulouse.datasets.urbanisme.VoirieHandler#getStreetId(org.openstreetmap.josm.data.osm.Way) 53 */ 54 @Override 55 protected String getStreetId(Way w) { 56 return w.get("code_insee")+"/"+w.get("name"); 57 } 58 58 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/CommuneHandler.java
r28044 r28554 22 22 public class CommuneHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public CommuneHandler() { 25 super(12582, "admin_level=8"); 26 setName("Communes"); 27 setCategory(CAT_URBANISME); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsKmzTabFilename(filename, "Limites_Communes"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Relation r : ds.getRelations()) { 38 r.put("type", "boundary"); 39 r.put("boundary", "administrative"); 40 r.put("admin_level", "8"); 41 replace(r, "libelle", "name"); 42 replace(r, "code_insee", "ref:INSEE"); 43 } 44 } 45 45 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/NumerosRueHandler.java
r28044 r28554 28 28 public class NumerosRueHandler extends ToulouseDataSetHandler { 29 29 30 31 32 33 34 30 public NumerosRueHandler() { 31 super(12673, "addr:housenumber"); 32 setWikiPage("Numéros de rue"); 33 setCategory(CAT_URBANISME); 34 } 35 35 36 37 38 39 36 @Override 37 public boolean acceptsFilename(String filename) { 38 return acceptsCsvKmzTabFilename(filename, "Numeros"); 39 } 40 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 41 @Override 42 public void updateDataSet(DataSet ds) { 43 Map<String, Relation> associatedStreets = new HashMap<String, Relation>(); 44 45 for (Node n : ds.getNodes()) { 46 replace(n, "no", "addr:housenumber"); 47 n.remove("numero"); 48 replace(n, "lib_off", "addr:street"); 49 n.remove("mot_directeur"); 50 n.remove("name"); 51 n.remove("rivoli"); 52 n.remove("nrivoli"); 53 //n.remove("sti"); 54 n.remove("color"); 55 String streetName = NamesFrUtils.checkStreetName(n, "addr:street"); 56 Relation street = associatedStreets.get(n.get("sti")); 57 if (street == null) { 58 associatedStreets.put(n.get("sti"), street = new Relation()); 59 street.put("type", "associatedStreet"); 60 street.put("name", streetName); 61 ds.addPrimitive(street); 62 } 63 street.addMember(new RelationMember("house", n)); 64 } 65 } 66 66 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/SanisetteHandler.java
r28044 r28554 22 22 public class SanisetteHandler extends ToulouseDataSetHandler { 23 23 24 25 26 27 28 24 public SanisetteHandler() { 25 super(12584, "amenity=toilets"); 26 setWikiPage("Sanisettes"); 27 setCategory(CAT_URBANISME); 28 } 29 29 30 31 32 33 30 @Override 31 public boolean acceptsFilename(String filename) { 32 return acceptsCsvKmzTabFilename(filename, "Sanisette"); 33 } 34 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 35 @Override 36 public void updateDataSet(DataSet ds) { 37 for (Node n : ds.getNodes()) { 38 n.remove("name"); 39 n.put("amenity", "toilets"); 40 n.put("supervised", "no"); 41 n.put("unisex", "yes"); 42 n.put("fee", "no"); 43 n.put("operator", "JCDecaux"); 44 n.put("opening_hours", "24/7"); 45 replace(n, "numero", "ref:grandtoulouse"); 46 replace(n, "PMR", "wheelchair", new String[]{"true", "false"}, new String[]{"yes", "no"}); 47 String valide = n.get("emplacement_valide"); 48 if (valide != null && valide.equalsIgnoreCase("non")) { 49 n.put("fixme", "L'emplacement semble invalide !"); 50 } else { 51 n.remove("emplacement_valide"); 52 } 53 n.remove("adresse"); 54 n.remove("INSEE"); 55 n.remove("color"); 56 } 57 } 58 58 } -
applications/editors/josm/plugins/opendata/modules/fr.toulouse/src/org/openstreetmap/josm/plugins/opendata/modules/fr/toulouse/datasets/urbanisme/VoirieHandler.java
r28044 r28554 31 31 public class VoirieHandler extends ToulouseDataSetHandler { 32 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 33 protected final Map<String, Collection<String>> map = new HashMap<String, Collection<String>>(); 34 35 private String streetField; 36 37 public VoirieHandler() { 38 this(12693, "lib_off", "highway"); 39 setName("Filaire de voirie"); 40 setCategory(CAT_URBANISME); 41 } 42 43 protected VoirieHandler(int portalId, String streetField, String relevantKey) { 44 super(portalId, relevantKey); 45 this.streetField = streetField; 46 map.put("motorway", Arrays.asList(new String[] {"A6", "AUTOROUTE "})); 47 map.put("trunk", Arrays.asList(new String[] {"ROCADE "})); 48 map.put("secondary", Arrays.asList(new String[] {"AV ", "BD ", "ALL ", "PONT ", "RTE ", "PORT ", "BOULINGRIN"})); 49 map.put("residential", Arrays.asList(new String[] {"RUE ", "GRANDE-RUE ", "PROM ", "CHE", "CAMINOT ", "IMP ", "COURS ", 50 "LOT ", "ANC", "VIEUX ", "PL ", "CLOS ", "CITE ", "RESIDENCE ", "SENTIER ", "QU ", "SQ ", "VOIE ", "ESP "})); 51 map.put("unclassified", Arrays.asList(new String[] {"ZONE "})); 52 map.put("road", Arrays.asList(new String[] {"VA "})); 53 } 54 55 @Override 56 public boolean acceptsFilename(String filename) { 57 return acceptsKmzTabFilename(filename, "Voies"); 58 } 59 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 60 private String applyHighwayTag(String name, IPrimitive p) { 61 if (name != null && p != null) { 62 for (String key : map.keySet()) { 63 for (String value : map.get(key)) { 64 if (name.startsWith(value)) { 65 p.put("highway", key); 66 return key; 67 } 68 } 69 } 70 } 71 return null; 72 } 73 74 protected String getStreetId(Way w) { 75 return w.get("sti"); 76 } 77 78 @Override 79 public void updateDataSet(DataSet ds) { 80 Map<String, Relation> associatedStreets = new HashMap<String, Relation>(); 81 82 for (Way w : ds.getWays()) { 83 String name = w.get(streetField); 84 if (name != null) { 85 w.remove(streetField); 86 w.remove("mot_directeur"); 87 w.remove("color"); 88 w.remove("rivoli"); 89 w.remove("nrivoli"); 90 91 if (applyHighwayTag(name, w) == null) { 92 w.put("highway", "road"); 93 } 94 95 if (name.startsWith("RPT ") || name.startsWith("GIRATOIRE ")) { 96 // TODO: find correct highway 97 w.put("junction", "roundabout"); 98 } else if (name.matches("RTE D[0-9]+")) { 99 w.put("ref", name.split(" ")[1]); 100 } 101 102 w.put("name", name); 103 104 if (name.matches("D[0-9]+.*")) { 105 w.put("highway", "secondary"); 106 replace(w, "name", "ref"); 107 } else if (!name.startsWith("VA ")) { // Unknown labels 108 name = NamesFrUtils.checkStreetName(w, "name"); 109 } 110 111 if (!name.startsWith("VA ")) { // Unknown labels 112 Relation street = associatedStreets.get(getStreetId(w)); 113 if (street == null) { 114 associatedStreets.put(getStreetId(w), street = new Relation()); 115 street.put("type", "associatedStreet"); 116 street.put("name", name); 117 ds.addPrimitive(street); 118 } 119 street.addMember(new RelationMember("street", w)); 120 } 121 } 122 } 123 } 124 124 }
Note:
See TracChangeset
for help on using the changeset viewer.