Skip to content

Commit

Permalink
Merge pull request #140 from Datenschule/update-berlin-fisbroker-url
Browse files Browse the repository at this point in the history
[BE] Update WFS-URL
  • Loading branch information
k-nut authored Jun 24, 2024
2 parents e6f02b8 + 5f149be commit 6f6634e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions jedeschule/spiders/berlin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class BerlinSpider(scrapy.Spider):
name = "berlin"
start_urls = ['https://fbinter.stadt-berlin.de/fb/wfs/data/senstadt/s_schulen?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&srsname=EPSG:25833&typename=fis:s_schulen']
start_urls = ['https://gdi.berlin.de/services/wfs/schulen?SERVICE=WFS&VERSION=1.1.0&REQUEST=GetFeature&srsname=EPSG:25833&typename=fis:schulen']

def parse(self, response):
tree = ET.fromstring(response.body)
Expand All @@ -16,10 +16,12 @@ def parse(self, response):
"gml": "http://www.opengis.net/gml",
"fis": "http://www.berlin.de/broker",
}
for school in tree.findall("gml:featureMember", namespaces):
for school in tree.find('gml:featureMembers', namespaces).findall("{schulen}schulen", namespaces):
data_elem = {}
for entry in school[0]:
if entry.tag == "{http://www.berlin.de/broker}geom":
for entry in school:
if entry.tag == '{http://www.opengis.net/gml}boundedBy':
continue
if entry.tag == "{schulen}geom":
# This nested entry contains the coordinates that we would like to expand
lat, lon = entry.findtext(
"gml:Point/gml:pos", namespaces=namespaces
Expand All @@ -33,7 +35,7 @@ def parse(self, response):

@staticmethod
def normalize(item: Item) -> School:
return School(name=item.get('name'),
return School(name=item.get('schulname'),
id='BE-{}'.format(item.get('bsn')),
address=" ".join([item.get('strasse'), item.get('hausnr')]),
zip=item.get('plz'),
Expand Down

0 comments on commit 6f6634e

Please sign in to comment.