Skip to content

Commit

Permalink
Merge pull request #3 from sigdeletras/03_sprint3
Browse files Browse the repository at this point in the history
PR 03 sprint3
  • Loading branch information
sigdeletras committed May 3, 2020
2 parents 1a8a866 + 2705f47 commit 986dcb5
Show file tree
Hide file tree
Showing 18 changed files with 154,946 additions and 94 deletions.
153,817 changes: 153,817 additions & 0 deletions data/ENTIDADES_clean.csv

Large diffs are not rendered by default.

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

import './App.css';

Expand All @@ -12,20 +12,32 @@ export default class App extends React.Component {
coordCenter: [37.885963680860755, -4.774589538574219],
munipalityName: '',
zoom: 9,
geodata: [],
code: ''
}
this.munipalityChange = this.munipalityChange.bind(this)
}

async getWFSData(code) {
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`
const res = await fetch(URL)
const data = await res.json();
this.setState({
geodata: data
})
}

munipalityChange = (data) => {
let aData = data.split(',')
this.setState({
coordCenter: [aData[0], aData[1]],
munipalityName: aData[2],
zoom: 14,
code: aData[3]
});
this.getWFSData(aData[3])
}


render() {
return (
<div className="container-fluid">
Expand All @@ -44,8 +56,14 @@ export default class App extends React.Component {
</div>
</div>
{/* Map */}

<div className="col-sm-8 col-sm-offset-4 col-md-10 col-md-offset-3">
<MapView coordCenter={this.state.coordCenter} zoom={this.state.zoom} />
{/* {!isLoaded && <h2> No cargado </h2>} */}
<MapView coordCenter={this.state.coordCenter}
zoom={this.state.zoom}
geodata={this.state.geodata}
code={this.state.code}>
</MapView>
</div>
</div>

Expand Down
44 changes: 44 additions & 0 deletions geoapp/src/components/MapLayer/MapLayer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { Component } from 'react'
import { GeoJSON } from 'react-leaflet';
import L from 'leaflet';

delete L.Icon.Default.prototype._getIconUrl;
L.Icon.Default.mergeOptions({
iconRetinaUrl: require('leaflet/dist/images/marker-icon-2x.png'),
iconUrl: require('leaflet/dist/images/marker-icon.png'),
shadowUrl: require('leaflet/dist/images/marker-shadow.png')
});

export default class MapLayer extends Component {

leafletRef = React.createRef();

componentWillReceiveProps(prevProps) {
if (prevProps.data !== this.props.data) {
this.leafletRef.current.leafletElement.clearLayers();
}
}

componentDidUpdate(prevProps) {
if (prevProps.data !== this.props.data) {
this.leafletRef.current.leafletElement.addData(this.props.data);
}
}

onEachFeature(feature, layer) {
const popupContent = `<Popup>
<pre>Centro: ${feature.properties.centro}</pre>
<pre>Tipo: ${feature.properties.tipocentro}</pre>
<pre>Titularidad: ${feature.properties.titularida}</pre>
</Popup>`
layer.bindPopup(popupContent)
}

render() {
return <GeoJSON
data = { this.props.data }
onEachFeature = { this.onEachFeature }
ref = { this.leafletRef }
/>
}
}
58 changes: 44 additions & 14 deletions geoapp/src/components/MapView/MapView.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,55 @@
import React from "react";
import { Map, TileLayer } from "react-leaflet";
import { Map, TileLayer, WMSTileLayer, LayersControl } from "react-leaflet";
import MapLayer from '../MapLayer/MapLayer'
import "leaflet/dist/leaflet.css";

class MapView extends React.Component {
export default class MapView extends React.Component {
constructor(props) {
super(props);
this.state = {
geodata: ''
};
}

render() {
const styleMap = { "width": "100%", "height": "60vh" }
const { BaseLayer, Overlay } = LayersControl

return (

<Map
style={styleMap}
center={this.props.coordCenter}
zoom={this.props.zoom}>

<TileLayer
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
attribution="&copy; <a href=&quot;http://osm.org/copyright&quot;>OpenStreetMap</a> contributors"
/>
</Map>
<div>
<Map
style={styleMap}
center={this.props.coordCenter}
zoom={this.props.zoom}>

<LayersControl position="topright">

<BaseLayer checked name="OpenStreetMap">
<TileLayer
attribution='&amp;copy <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>
</BaseLayer>

<BaseLayer name="PNOA">
<WMSTileLayer
layers={'OI.OrthoimageCoverage'}
attribution='&copy; <a href="http://osm.org/copyright">IGN</a>'
url="http://www.ign.es/wms-inspire/pnoa-ma?"
/>
</BaseLayer>

<Overlay checked name="Servicios Sanitarios (DERA)">
<MapLayer data={this.props.geodata} />
</Overlay>

</LayersControl>

</Map>
</div>
)

}

}

export default MapView;
2 changes: 1 addition & 1 deletion geoapp/src/components/SelectList/SelectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class SelectList extends React.Component {
<select className="form-control" onChange={this.selectListChange}>
<option value="">Select one...</option>
{data.map((m) =>
<option key={m.id} value={[m.coordinates, m.name]}>{m.name}</option>
<option key={m.id} value={[m.coordinates, m.name, m.code]}>{m.name}</option>
)}
</select>
<button className="btn btn-primary mt-3 mb-3"
Expand Down
Loading

0 comments on commit 986dcb5

Please sign in to comment.