File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed
Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1+ # Changelog
2+
3+ ## 2025-04-22
4+ - [ HH] : The data now includes the location information from the WFS, filling the ` location ` field in the database
5+ for the city of Hamburg for the first time
Original file line number Diff line number Diff line change @@ -10,15 +10,29 @@ class HamburgSpider(SchoolSpider):
1010 name = "hamburg"
1111
1212 start_urls = [
13- "https://geodienste.hamburg.de/HH_WFS_Schulen?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&typename=de.hh.up:nicht_staatliche_schulen,de.hh.up:staatliche_schulen"
13+ "https://geodienste.hamburg.de/HH_WFS_Schulen?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&typename=de.hh.up:nicht_staatliche_schulen,de.hh.up:staatliche_schulen&srsname=EPSG:4326 "
1414 ]
1515
16+
1617 def parse (self , response ):
18+ namespaces = {
19+ "gml" : "http://www.opengis.net/gml" ,
20+ }
21+
1722 elem = ET .fromstring (response .body )
1823
1924 for member in elem :
2025 data_elem = {}
2126 for attr in member [0 ]:
27+ if attr .tag == "{https://registry.gdi-de.org/id/de.hh.up}the_geom" :
28+ # This nested entry contains the coordinates that we would like to expand
29+ lon , lat = attr .findtext (
30+ "gml:Point/gml:pos" , namespaces = namespaces
31+ ).split (" " )
32+ data_elem ["lat" ] = lat
33+ data_elem ["lon" ] = lon
34+ continue
35+ # strip the namespace before returning
2236 data_elem [attr .tag .split ("}" , 1 )[1 ]] = attr .text
2337 yield data_elem
2438
@@ -39,4 +53,6 @@ def normalize(item: Item) -> School:
3953 fax = item .get ("fax" ),
4054 phone = item .get ("schul_telefonnr" ),
4155 director = item .get ("name_schulleiter" ),
56+ latitude = item .get ("lat" ),
57+ longitude = item .get ("lon" ),
4258 )
You can’t perform that action at this time.
0 commit comments