Skip to content

Commit 986dcb5

Browse files
authored
Merge pull request #3 from sigdeletras/03_sprint3
PR 03 sprint3
2 parents 1a8a866 + 2705f47 commit 986dcb5

18 files changed

Lines changed: 154946 additions & 94 deletions

data/ENTIDADES_clean.csv

Lines changed: 153817 additions & 0 deletions
Large diffs are not rendered by default.

data/cordoba.csv

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
id;name;codprov;code;long;lat;coordinates
2+
1;Adamuz;14;14001;-4.52617749;38.02512572;[38.02512572,-4.52617749]
3+
2;Aguilar de la Frontera;14;14002;-4.66061547;37.52004219;[37.52004219,-4.66061547]
4+
3;Alcaracejos;14;14003;-4.96709118;38.38656136;[38.38656136,-4.96709118]
5+
4;Aldea de Fuente Carreteros;14;14901;-5.155460537;37.66907784;[37.66907784,-5.155460537]
6+
5;Almedinilla;14;14004;-4.09001992;37.43947257;[37.43947257,-4.09001992]
7+
6;Almodóvar del Río;14;14005;-5.02076595;37.80943577;[37.80943577,-5.02076595]
8+
7;Añora;14;14006;-4.89754391;38.41255111;[38.41255111,-4.89754391]
9+
8;Baena;14;14007;-4.32895878;37.61318847;[37.61318847,-4.32895878]
10+
9;Belalcázar;14;14008;-5.16635159;38.57840844;[38.57840844,-5.16635159]
11+
10;Belmez;14;14009;-5.20945663;38.2732496;[38.2732496,-5.20945663]
12+
11;Benamejí;14;14010;-4.53987316;37.26716339;[37.26716339,-4.53987316]
13+
12;Bujalance;14;14012;-4.38339381;37.89649386;[37.89649386,-4.38339381]
14+
13;Cabra;14;14013;-4.44656669;37.47101586;[37.47101586,-4.44656669]
15+
14;Cañete de las Torres;14;14014;-4.31772885;37.86729904;[37.86729904,-4.31772885]
16+
15;Carcabuey;14;14015;-4.27306704;37.44453021;[37.44453021,-4.27306704]
17+
16;Cardeña;14;14016;-4.32426689;38.27037293;[38.27037293,-4.32426689]
18+
17;Castro del Río;14;14019;-4.48168693;37.69040121;[37.69040121,-4.48168693]
19+
18;Conquista;14;14020;-4.50055371;38.40958084;[38.40958084,-4.50055371]
20+
19;Córdoba;14;14021;-4.78032455;37.87954225;[37.87954225,-4.78032455]
21+
20;Doña Mencía;14;14022;-4.3594167;37.55542058;[37.55542058,-4.3594167]
22+
21;Dos Torres;14;14023;-4.89495696;38.44549239;[38.44549239,-4.89495696]
23+
22;El Carpio;14;14018;-4.49948242;37.94050285;[37.94050285,-4.49948242]
24+
23;El Guijo;14;14034;-4.78336513;38.49620069;[38.49620069,-4.78336513]
25+
24;El Viso;14;14074;-4.95549169;38.48377684;[38.48377684,-4.95549169]
26+
25;Encinas Reales;14;14024;-4.48724904;37.27334279;[37.27334279,-4.48724904]
27+
26;Espejo;14;14025;-4.55377679;37.68083913;[37.68083913,-4.55377679]
28+
27;Espiel;14;14026;-5.01731472;38.18906775;[38.18906775,-5.01731472]
29+
28;Fernán-Núñez;14;14027;-4.71932943;37.66833878;[37.66833878,-4.71932943]
30+
29;Fuente la Lancha;14;14028;-5.04888706;38.42211433;[38.42211433,-5.04888706]
31+
30;Fuente Obejuna;14;14029;-5.41923282;38.26702154;[38.26702154,-5.41923282]
32+
31;Fuente Palmera;14;14030;-5.10411463;37.70323501;[37.70323501,-5.10411463]
33+
32;Fuente-Tójar;14;14031;-4.14651434;37.50974593;[37.50974593,-4.14651434]
34+
33;Guadalcázar;14;14033;-4.94537097;37.75846258;[37.75846258,-4.94537097]
35+
34;Hinojosa del Duque;14;14035;-5.14848249;38.50061616;[38.50061616,-5.14848249]
36+
35;Hornachuelos;14;14036;-5.24226581;37.83117536;[37.83117536,-5.24226581]
37+
36;Iznájar;14;14037;-4.30793236;37.25784671;[37.25784671,-4.30793236]
38+
37;La Carlota;14;14017;-4.93225379;37.67519215;[37.67519215,-4.93225379]
39+
38;La Granjuela;14;14032;-5.35167331;38.3699257;[38.3699257,-5.35167331]
40+
39;La Guijarrosa;14;14902;-4.86509246;37.63648413;[37.63648413,-4.86509246]
41+
40;La Rambla;14;14057;-4.74076968;37.60858832;[37.60858832,-4.74076968]
42+
41;La Victoria;14;14065;-4.85258274;37.68081318;[37.68081318,-4.85258274]
43+
42;Los Blázquez;14;14011;-5.43808665;38.406797;[38.406797,-5.43808665]
44+
43;Lucena;14;14038;-4.48451348;37.40901404;[37.40901404,-4.48451348]
45+
44;Luque;14;14039;-4.27765852;37.55956888;[37.55956888,-4.27765852]
46+
45;Montalbán de Córdoba;14;14040;-4.74928409;37.58273217;[37.58273217,-4.74928409]
47+
46;Montemayor;14;14041;-4.69899102;37.64747277;[37.64747277,-4.69899102]
48+
47;Montilla;14;14042;-4.63785702;37.59232558;[37.59232558,-4.63785702]
49+
48;Montoro;14;14043;-4.38130891;38.02639376;[38.02639376,-4.38130891]
50+
49;Monturque;14;14044;-4.58088184;37.47356745;[37.47356745,-4.58088184]
51+
50;Moriles;14;14045;-4.60916325;37.43498961;[37.43498961,-4.60916325]
52+
51;Nueva Carteya;14;14046;-4.46660548;37.58553839;[37.58553839,-4.46660548]
53+
52;Obejo;14;14047;-4.80059964;38.13442999;[38.13442999,-4.80059964]
54+
53;Palenciana;14;14048;-4.58251386;37.24883679;[37.24883679,-4.58251386]
55+
54;Palma del Río;14;14049;-5.28521754;37.70113499;[37.70113499,-5.28521754]
56+
55;Pedro Abad;14;14050;-4.45502044;37.96637631;[37.96637631,-4.45502044]
57+
56;Pedroche;14;14051;-4.76362098;38.42795152;[38.42795152,-4.76362098]
58+
57;Peñarroya-Pueblonuevo;14;14052;-5.26610998;38.29876873;[38.29876873,-5.26610998]
59+
58;Posadas;14;14053;-5.10716405;37.80042527;[37.80042527,-5.10716405]
60+
59;Pozoblanco;14;14054;-4.84958064;38.37888591;[38.37888591,-4.84958064]
61+
60;Priego de Córdoba;14;14055;-4.191759;37.43981618;[37.43981618,-4.191759]
62+
61;Puente Genil;14;14056;-4.77225259;37.3883058;[37.3883058,-4.77225259]
63+
62;Rute;14;14058;-4.37022684;37.32526431;[37.32526431,-4.37022684]
64+
63;San Sebastián de los Ballesteros;14;14059;-4.82514553;37.65457388;[37.65457388,-4.82514553]
65+
64;Santa Eufemia;14;14061;-4.90500504;38.59608265;[38.59608265,-4.90500504]
66+
65;Santaella;14;14060;-4.84662658;37.56749755;[37.56749755,-4.84662658]
67+
66;Torrecampo;14;14062;-4.68026045;38.47447529;[38.47447529,-4.68026045]
68+
67;Valenzuela;14;14063;-4.21935803;37.77497124;[37.77497124,-4.21935803]
69+
68;Valsequillo;14;14064;-5.35173539;38.40505636;[38.40505636,-5.35173539]
70+
69;Villa del Río;14;14066;-4.29093006;37.98234127;[37.98234127,-4.29093006]
71+
70;Villafranca de Córdoba;14;14067;-4.54554878;37.96233796;[37.96233796,-4.54554878]
72+
71;Villaharta;14;14068;-4.90308829;38.1396903;[38.1396903,-4.90308829]
73+
72;Villanueva de Córdoba;14;14069;-4.62846311;38.32241888;[38.32241888,-4.62846311]
74+
73;Villanueva del Duque;14;14070;-4.99945439;38.39272715;[38.39272715,-4.99945439]
75+
74;Villanueva del Rey;14;14071;-5.15082199;38.20045817;[38.20045817,-5.15082199]
76+
75;Villaralto;14;14072;-4.98421173;38.45542319;[38.45542319,-4.98421173]
77+
76;Villaviciosa de Córdoba;14;14073;-5.0146828;38.07637233;[38.07637233,-5.0146828]
78+
77;Zuheros;14;14075;-4.31649861;37.54383838;[37.54383838,-4.31649861]

data/cordoba.ods

23.4 KB
Binary file not shown.

data/cordoba_json.csv

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
id;name;codprov;code;coordinates
2+
1;Adamuz;14;14001;[38.02512572,-4.52617749]
3+
2;Aguilar de la Frontera;14;14002;[37.52004219,-4.66061547]
4+
3;Alcaracejos;14;14003;[38.38656136,-4.96709118]
5+
4;Aldea de Fuente Carreteros;14;14901;[37.66907784,-5.155460537]
6+
5;Almedinilla;14;14004;[37.43947257,-4.09001992]
7+
6;Almodóvar del Río;14;14005;[37.80943577,-5.02076595]
8+
7;Añora;14;14006;[38.41255111,-4.89754391]
9+
8;Baena;14;14007;[37.61318847,-4.32895878]
10+
9;Belalcázar;14;14008;[38.57840844,-5.16635159]
11+
10;Belmez;14;14009;[38.2732496,-5.20945663]
12+
11;Benamejí;14;14010;[37.26716339,-4.53987316]
13+
12;Bujalance;14;14012;[37.89649386,-4.38339381]
14+
13;Cabra;14;14013;[37.47101586,-4.44656669]
15+
14;Cañete de las Torres;14;14014;[37.86729904,-4.31772885]
16+
15;Carcabuey;14;14015;[37.44453021,-4.27306704]
17+
16;Cardeña;14;14016;[38.27037293,-4.32426689]
18+
17;Castro del Río;14;14019;[37.69040121,-4.48168693]
19+
18;Conquista;14;14020;[38.40958084,-4.50055371]
20+
19;Córdoba;14;14021;[37.87954225,-4.78032455]
21+
20;Doña Mencía;14;14022;[37.55542058,-4.3594167]
22+
21;Dos Torres;14;14023;[38.44549239,-4.89495696]
23+
22;El Carpio;14;14018;[37.94050285,-4.49948242]
24+
23;El Guijo;14;14034;[38.49620069,-4.78336513]
25+
24;El Viso;14;14074;[38.48377684,-4.95549169]
26+
25;Encinas Reales;14;14024;[37.27334279,-4.48724904]
27+
26;Espejo;14;14025;[37.68083913,-4.55377679]
28+
27;Espiel;14;14026;[38.18906775,-5.01731472]
29+
28;Fernán-Núñez;14;14027;[37.66833878,-4.71932943]
30+
29;Fuente la Lancha;14;14028;[38.42211433,-5.04888706]
31+
30;Fuente Obejuna;14;14029;[38.26702154,-5.41923282]
32+
31;Fuente Palmera;14;14030;[37.70323501,-5.10411463]
33+
32;Fuente-Tójar;14;14031;[37.50974593,-4.14651434]
34+
33;Guadalcázar;14;14033;[37.75846258,-4.94537097]
35+
34;Hinojosa del Duque;14;14035;[38.50061616,-5.14848249]
36+
35;Hornachuelos;14;14036;[37.83117536,-5.24226581]
37+
36;Iznájar;14;14037;[37.25784671,-4.30793236]
38+
37;La Carlota;14;14017;[37.67519215,-4.93225379]
39+
38;La Granjuela;14;14032;[38.3699257,-5.35167331]
40+
39;La Guijarrosa;14;14902;[37.63648413,-4.86509246]
41+
40;La Rambla;14;14057;[37.60858832,-4.74076968]
42+
41;La Victoria;14;14065;[37.68081318,-4.85258274]
43+
42;Los Blázquez;14;14011;[38.406797,-5.43808665]
44+
43;Lucena;14;14038;[37.40901404,-4.48451348]
45+
44;Luque;14;14039;[37.55956888,-4.27765852]
46+
45;Montalbán de Córdoba;14;14040;[37.58273217,-4.74928409]
47+
46;Montemayor;14;14041;[37.64747277,-4.69899102]
48+
47;Montilla;14;14042;[37.59232558,-4.63785702]
49+
48;Montoro;14;14043;[38.02639376,-4.38130891]
50+
49;Monturque;14;14044;[37.47356745,-4.58088184]
51+
50;Moriles;14;14045;[37.43498961,-4.60916325]
52+
51;Nueva Carteya;14;14046;[37.58553839,-4.46660548]
53+
52;Obejo;14;14047;[38.13442999,-4.80059964]
54+
53;Palenciana;14;14048;[37.24883679,-4.58251386]
55+
54;Palma del Río;14;14049;[37.70113499,-5.28521754]
56+
55;Pedro Abad;14;14050;[37.96637631,-4.45502044]
57+
56;Pedroche;14;14051;[38.42795152,-4.76362098]
58+
57;Peñarroya-Pueblonuevo;14;14052;[38.29876873,-5.26610998]
59+
58;Posadas;14;14053;[37.80042527,-5.10716405]
60+
59;Pozoblanco;14;14054;[38.37888591,-4.84958064]
61+
60;Priego de Córdoba;14;14055;[37.43981618,-4.191759]
62+
61;Puente Genil;14;14056;[37.3883058,-4.77225259]
63+
62;Rute;14;14058;[37.32526431,-4.37022684]
64+
63;San Sebastián de los Ballesteros;14;14059;[37.65457388,-4.82514553]
65+
64;Santa Eufemia;14;14061;[38.59608265,-4.90500504]
66+
65;Santaella;14;14060;[37.56749755,-4.84662658]
67+
66;Torrecampo;14;14062;[38.47447529,-4.68026045]
68+
67;Valenzuela;14;14063;[37.77497124,-4.21935803]
69+
68;Valsequillo;14;14064;[38.40505636,-5.35173539]
70+
69;Villa del Río;14;14066;[37.98234127,-4.29093006]
71+
70;Villafranca de Córdoba;14;14067;[37.96233796,-4.54554878]
72+
71;Villaharta;14;14068;[38.1396903,-4.90308829]
73+
72;Villanueva de Córdoba;14;14069;[38.32241888,-4.62846311]
74+
73;Villanueva del Duque;14;14070;[38.39272715,-4.99945439]
75+
74;Villanueva del Rey;14;14071;[38.20045817,-5.15082199]
76+
75;Villaralto;14;14072;[38.45542319,-4.98421173]
77+
76;Villaviciosa de Córdoba;14;14073;[38.07637233,-5.0146828]
78+
77;Zuheros;14;14075;[37.54383838,-4.31649861]

geoapp/src/App.js

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
2-
import MapView from './components/MapView/MapView.js'
3-
import SelectList from './components/SelectList/SelectList.js';
2+
import MapView from './components/MapView/MapView'
3+
import SelectList from './components/SelectList/SelectList';
44

55
import './App.css';
66

@@ -12,20 +12,32 @@ export default class App extends React.Component {
1212
coordCenter: [37.885963680860755, -4.774589538574219],
1313
munipalityName: '',
1414
zoom: 9,
15+
geodata: [],
16+
code: ''
1517
}
1618
this.munipalityChange = this.munipalityChange.bind(this)
1719
}
1820

21+
async getWFSData(code) {
22+
const URL = `http://www.ideandalucia.es/dea100/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=dea100:sv03_sas&MAXFEATURES=10&outputFormat=application/json&filter=<Filter><PropertyIsEqualTo><PropertyName>codmun</PropertyName><Literal>${code}</Literal></PropertyIsEqualTo></Filter>&SRSNAME=EPSG:4326`
23+
const res = await fetch(URL)
24+
const data = await res.json();
25+
this.setState({
26+
geodata: data
27+
})
28+
}
29+
1930
munipalityChange = (data) => {
2031
let aData = data.split(',')
2132
this.setState({
2233
coordCenter: [aData[0], aData[1]],
2334
munipalityName: aData[2],
2435
zoom: 14,
36+
code: aData[3]
2537
});
38+
this.getWFSData(aData[3])
2639
}
2740

28-
2941
render() {
3042
return (
3143
<div className="container-fluid">
@@ -44,8 +56,14 @@ export default class App extends React.Component {
4456
</div>
4557
</div>
4658
{/* Map */}
59+
4760
<div className="col-sm-8 col-sm-offset-4 col-md-10 col-md-offset-3">
48-
<MapView coordCenter={this.state.coordCenter} zoom={this.state.zoom} />
61+
{/* {!isLoaded && <h2> No cargado </h2>} */}
62+
<MapView coordCenter={this.state.coordCenter}
63+
zoom={this.state.zoom}
64+
geodata={this.state.geodata}
65+
code={this.state.code}>
66+
</MapView>
4967
</div>
5068
</div>
5169

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React, { Component } from 'react'
2+
import { GeoJSON } from 'react-leaflet';
3+
import L from 'leaflet';
4+
5+
delete L.Icon.Default.prototype._getIconUrl;
6+
L.Icon.Default.mergeOptions({
7+
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
8+
iconUrl: require('leaflet/dist/images/marker-icon.png'),
9+
shadowUrl: require('leaflet/dist/images/marker-shadow.png')
10+
});
11+
12+
export default class MapLayer extends Component {
13+
14+
leafletRef = React.createRef();
15+
16+
componentWillReceiveProps(prevProps) {
17+
if (prevProps.data !== this.props.data) {
18+
this.leafletRef.current.leafletElement.clearLayers();
19+
}
20+
}
21+
22+
componentDidUpdate(prevProps) {
23+
if (prevProps.data !== this.props.data) {
24+
this.leafletRef.current.leafletElement.addData(this.props.data);
25+
}
26+
}
27+
28+
onEachFeature(feature, layer) {
29+
const popupContent = `<Popup>
30+
<pre>Centro: ${feature.properties.centro}</pre>
31+
<pre>Tipo: ${feature.properties.tipocentro}</pre>
32+
<pre>Titularidad: ${feature.properties.titularida}</pre>
33+
</Popup>`
34+
layer.bindPopup(popupContent)
35+
}
36+
37+
render() {
38+
return <GeoJSON
39+
data = { this.props.data }
40+
onEachFeature = { this.onEachFeature }
41+
ref = { this.leafletRef }
42+
/>
43+
}
44+
}

geoapp/src/components/MapView/MapView.js

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,55 @@
11
import React from "react";
2-
import { Map, TileLayer } from "react-leaflet";
2+
import { Map, TileLayer, WMSTileLayer, LayersControl } from "react-leaflet";
3+
import MapLayer from '../MapLayer/MapLayer'
34
import "leaflet/dist/leaflet.css";
45

5-
class MapView extends React.Component {
6+
export default class MapView extends React.Component {
7+
constructor(props) {
8+
super(props);
9+
this.state = {
10+
geodata: ''
11+
};
12+
}
13+
614
render() {
715
const styleMap = { "width": "100%", "height": "60vh" }
16+
const { BaseLayer, Overlay } = LayersControl
17+
818
return (
9-
10-
<Map
11-
style={styleMap}
12-
center={this.props.coordCenter}
13-
zoom={this.props.zoom}>
14-
15-
<TileLayer
16-
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
17-
attribution="&copy; <a href=&quot;http://osm.org/copyright&quot;>OpenStreetMap</a> contributors"
18-
/>
19-
</Map>
19+
<div>
20+
<Map
21+
style={styleMap}
22+
center={this.props.coordCenter}
23+
zoom={this.props.zoom}>
24+
25+
<LayersControl position="topright">
26+
27+
<BaseLayer checked name="OpenStreetMap">
28+
<TileLayer
29+
attribution='&amp;copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
30+
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
31+
/>
32+
</BaseLayer>
33+
34+
<BaseLayer name="PNOA">
35+
<WMSTileLayer
36+
layers={'OI.OrthoimageCoverage'}
37+
attribution='&copy; <a href="http://osm.org/copyright">IGN</a>'
38+
url="http://www.ign.es/wms-inspire/pnoa-ma?"
39+
/>
40+
</BaseLayer>
41+
42+
<Overlay checked name="Servicios Sanitarios (DERA)">
43+
<MapLayer data={this.props.geodata} />
44+
</Overlay>
45+
46+
</LayersControl>
47+
48+
</Map>
49+
</div>
2050
)
51+
2152
}
2253

2354
}
2455

25-
export default MapView;

geoapp/src/components/SelectList/SelectList.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default class SelectList extends React.Component {
2424
<select className="form-control" onChange={this.selectListChange}>
2525
<option value="">Select one...</option>
2626
{data.map((m) =>
27-
<option key={m.id} value={[m.coordinates, m.name]}>{m.name}</option>
27+
<option key={m.id} value={[m.coordinates, m.name, m.code]}>{m.name}</option>
2828
)}
2929
</select>
3030
<button className="btn btn-primary mt-3 mb-3"

0 commit comments

Comments
 (0)