1 | // JOSM opendata plugin.
|
---|
2 | // Copyright (C) 2011-2012 Don-vip
|
---|
3 | //
|
---|
4 | // This program is free software: you can redistribute it and/or modify
|
---|
5 | // it under the terms of the GNU General Public License as published by
|
---|
6 | // the Free Software Foundation, either version 3 of the License, or
|
---|
7 | // (at your option) any later version.
|
---|
8 | //
|
---|
9 | // This program is distributed in the hope that it will be useful,
|
---|
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
12 | // GNU General Public License for more details.
|
---|
13 | //
|
---|
14 | // You should have received a copy of the GNU General Public License
|
---|
15 | // along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
16 | package org.openstreetmap.josm.plugins.opendata.modules.fr.datagouvfr.datasets.education;
|
---|
17 |
|
---|
18 | import java.nio.charset.Charset;
|
---|
19 |
|
---|
20 | import org.openstreetmap.josm.data.coor.EastNorth;
|
---|
21 | import org.openstreetmap.josm.data.coor.LatLon;
|
---|
22 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
23 | import org.openstreetmap.josm.data.osm.Node;
|
---|
24 | import org.openstreetmap.josm.plugins.opendata.modules.fr.datagouvfr.datasets.DataGouvDataSetHandler;
|
---|
25 |
|
---|
26 | public class Etab1er2ndDegreHandler extends DataGouvDataSetHandler {
|
---|
27 |
|
---|
28 | public Etab1er2ndDegreHandler() {
|
---|
29 | super("Géolocalisation-des-établissements-d'enseignement-du-premier-degré-et-du-second-degré-du-ministère-d-30378093");
|
---|
30 | setName("Établissements d'enseignement du premier degré et du second degré");
|
---|
31 | setDataGouvFrUrl("MENJVA_etab_geoloc.csv");
|
---|
32 | }
|
---|
33 |
|
---|
34 | @Override
|
---|
35 | public boolean acceptsFilename(String filename) {
|
---|
36 | return acceptsCsvFilename(filename, "MENJVA_etab_geoloc(\\.csv-fr)?");
|
---|
37 | }
|
---|
38 |
|
---|
39 | @Override
|
---|
40 | public void updateDataSet(DataSet ds) {
|
---|
41 | for (Node n : ds.getNodes()) {
|
---|
42 | n.put("amenity", "school");
|
---|
43 | replace(n, "numero_uai", "ref:FR:UAI");
|
---|
44 | replace(n, "appellation_officielle_uai", "name");
|
---|
45 | add(n, "lib_nature", "school:FR",
|
---|
46 | new String[]{".*MATERNELLE.*", ".*ELEMENTAIRE.*", "COLLEGE.*", "LYCEE.*"},
|
---|
47 | new String[]{"maternelle", "élémentaire", "college", "lycée"});
|
---|
48 | n.remove("etat_etablissement"); // Toujours a 1
|
---|
49 | n.remove("nature_uai"); // cle numerique associe au champ lib_nature, redondant, donc
|
---|
50 | n.remove("patronyme_uai"); // deja dans le nom
|
---|
51 | n.remove("sous_fic"); // cycle ? 1 pour ecoles, 3 pour colleges et lycees
|
---|
52 | // Voir http://www.infocentre.education.fr/bcn/domaine/voir/id/31
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | /* (non-Javadoc)
|
---|
57 | * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#handlesCsvProjection()
|
---|
58 | */
|
---|
59 | @Override
|
---|
60 | public boolean handlesSpreadSheetProjection() {
|
---|
61 | return true;
|
---|
62 | }
|
---|
63 |
|
---|
64 | /* (non-Javadoc)
|
---|
65 | * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#getCsvCoor(org.openstreetmap.josm.data.coor.EastNorth, java.lang.String[])
|
---|
66 | */
|
---|
67 | @Override
|
---|
68 | public LatLon getSpreadSheetCoor(EastNorth en, String[] fields) {
|
---|
69 | return getLatLonByDptCode(en, fields[0].substring(0, 3), false);
|
---|
70 | }
|
---|
71 |
|
---|
72 | /* (non-Javadoc)
|
---|
73 | * @see org.openstreetmap.josm.plugins.opendata.core.datasets.AbstractDataSetHandler#getCsvCharset()
|
---|
74 | */
|
---|
75 | @Override
|
---|
76 | public Charset getCsvCharset() {
|
---|
77 | return Charset.forName(ISO8859_15);
|
---|
78 | }
|
---|
79 | }
|
---|