diff --git a/.gitignore b/.gitignore index 781863a..9274b79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.qgs~ -.project \ No newline at end of file +.project +out/ +.cache/ diff --git a/README.md b/README.md index 607da08..caf9d79 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Dieses Repository stellt die Karte der Verkehrs- und Tarifverbünde in Deutschland bereit. -Es bietet ein [QGIS](http://www.qgis.org/)-Projekt mit Geodaten der Verkehrs- und Tarifverbünde in Vektor-Form (ShapeFiles). +Es bietet ein [QGIS](http://www.qgis.org/)-Projekt mit Geodaten der Verkehrs- und Tarifverbünde in Vektor-Form (ShapeFiles bzw. zukünftig GeoJSON). # Übersicht @@ -20,6 +20,7 @@ Links: * [transit.land](https://transit.land/feed-registry/?country=Germany&sort_key=country) * [transitfeeds.com](http://transitfeeds.com/) +* [gtfs.mfdz.de](https://gtfs.mfdz.de/) (Links zu Feeds inkl. Lizenzangabe und ggf. Quellenvermerk) ### SWU @@ -89,7 +90,7 @@ Karlsruher Verkehrsverbund ### VGN -Ver­kehrs­ver­bund Groß­raum Nürn­berg +Verkehrsverbund Großraum Nürnberg * [GTFS](https://www.vgn.de/web-entwickler/open-data/) – offiziell, [CC BY 3.0 DE](https://creativecommons.org/licenses/by/3.0/de/), kein Antrag nötig @@ -162,6 +163,12 @@ Verbundkarte\DE\download.bat Verbundkarte\DE\HE\download.bat Verbundkarte\DE\SH\download.bat ``` +## Neu: Erstellung via Python + +* via `pip install -r requirements.txt` Geopandas und SPARQLWrapper installieren +* via `python3 merge.py` aufrufen, welches Informationen den CSV-Dateien `data/assignments.csv` und `data/authorities.csv` mit adhoc vom BKG runtergeladenen +Geometrie-Informationen zusammenführt. Ergebnis wird nach `out/authorities_enhanced.csv` geschrieben. Hinweis: die Verwaltungsgrenzen unterliegen der DE-DL/BY-2.0, Quellenvermerk `© GeoBasis-DE / BKG ()` +* via QGIS kann eine Kartendarstellung (vorerst manuell) erzeugt und gespeichert werden. # Lizenz diff --git a/Verbundkarte2.qgs b/Verbundkarte2.qgs new file mode 100644 index 0000000..6ea7a29 --- /dev/null +++ b/Verbundkarte2.qgs @@ -0,0 +1,2240 @@ + + + + Verbundkarte + + + + + PROJCRS["ETRS89 / UTM zone 32N",BASEGEOGCRS["ETRS89",ENSEMBLE["European Terrestrial Reference System 1989 ensemble",MEMBER["European Terrestrial Reference Frame 1989"],MEMBER["European Terrestrial Reference Frame 1990"],MEMBER["European Terrestrial Reference Frame 1991"],MEMBER["European Terrestrial Reference Frame 1992"],MEMBER["European Terrestrial Reference Frame 1993"],MEMBER["European Terrestrial Reference Frame 1994"],MEMBER["European Terrestrial Reference Frame 1996"],MEMBER["European Terrestrial Reference Frame 1997"],MEMBER["European Terrestrial Reference Frame 2000"],MEMBER["European Terrestrial Reference Frame 2005"],MEMBER["European Terrestrial Reference Frame 2014"],ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[0.1]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4258]],CONVERSION["UTM zone 32N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",9,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."],BBOX[38.76,6,84.33,12]],ID["EPSG",25832]] + +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + 2105 + 25832 + EPSG:25832 + ETRS89 / UTM zone 32N + utm + EPSG:7019 + false + + + + + + + + + + + + authorities_enhanced_1c7a4c5f_eddf_46c7_a5a1_bf2d4c2a9cff + + + + + + + + + + + meters + + -91002.29952898935880512 + 5166897.89832390937954187 + 1221605.96439749468117952 + 6214089.05005937721580267 + + 0 + + + PROJCRS["ETRS89 / UTM zone 32N",BASEGEOGCRS["ETRS89",ENSEMBLE["European Terrestrial Reference System 1989 ensemble",MEMBER["European Terrestrial Reference Frame 1989"],MEMBER["European Terrestrial Reference Frame 1990"],MEMBER["European Terrestrial Reference Frame 1991"],MEMBER["European Terrestrial Reference Frame 1992"],MEMBER["European Terrestrial Reference Frame 1993"],MEMBER["European Terrestrial Reference Frame 1994"],MEMBER["European Terrestrial Reference Frame 1996"],MEMBER["European Terrestrial Reference Frame 1997"],MEMBER["European Terrestrial Reference Frame 2000"],MEMBER["European Terrestrial Reference Frame 2005"],MEMBER["European Terrestrial Reference Frame 2014"],ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[0.1]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4258]],CONVERSION["UTM zone 32N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",9,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."],BBOX[38.76,6,84.33,12]],ID["EPSG",25832]] + +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + 2105 + 25832 + EPSG:25832 + ETRS89 / UTM zone 32N + utm + EPSG:7019 + false + + + 0 + + + + + + + + + + + degrees + + 0 + 0 + 0 + 0 + + 0 + + + GEOGCRS["WGS 84",ENSEMBLE["World Geodetic System 1984 ensemble",MEMBER["World Geodetic System 1984 (Transit)"],MEMBER["World Geodetic System 1984 (G730)"],MEMBER["World Geodetic System 1984 (G873)"],MEMBER["World Geodetic System 1984 (G1150)"],MEMBER["World Geodetic System 1984 (G1674)"],MEMBER["World Geodetic System 1984 (G1762)"],ELLIPSOID["WGS 84",6378137,298.257223563,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[2.0]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],CS[ellipsoidal,2],AXIS["geodetic latitude (Lat)",north,ORDER[1],ANGLEUNIT["degree",0.0174532925199433]],AXIS["geodetic longitude (Lon)",east,ORDER[2],ANGLEUNIT["degree",0.0174532925199433]],USAGE[SCOPE["Horizontal component of 3D system."],AREA["World."],BBOX[-90,-180,90,180]],ID["EPSG",4326]] + +proj=longlat +datum=WGS84 +no_defs + 3452 + 4326 + EPSG:4326 + WGS 84 + longlat + EPSG:7030 + true + + + 0 + + + + Beschriftungen_0f5bed7a_b072_446b_8691_b87395563e0c + + + + + + + + PROJCRS["ETRS89 / UTM zone 32N",BASEGEOGCRS["ETRS89",ENSEMBLE["European Terrestrial Reference System 1989 ensemble",MEMBER["European Terrestrial Reference Frame 1989"],MEMBER["European Terrestrial Reference Frame 1990"],MEMBER["European Terrestrial Reference Frame 1991"],MEMBER["European Terrestrial Reference Frame 1992"],MEMBER["European Terrestrial Reference Frame 1993"],MEMBER["European Terrestrial Reference Frame 1994"],MEMBER["European Terrestrial Reference Frame 1996"],MEMBER["European Terrestrial Reference Frame 1997"],MEMBER["European Terrestrial Reference Frame 2000"],MEMBER["European Terrestrial Reference Frame 2005"],MEMBER["European Terrestrial Reference Frame 2014"],ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[0.1]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4258]],CONVERSION["UTM zone 32N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",9,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."],BBOX[38.76,6,84.33,12]],ID["EPSG",25832]] + +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + 2105 + 25832 + EPSG:25832 + ETRS89 / UTM zone 32N + utm + EPSG:7019 + false + + + + + + + + + + + + + + + + + 0 + 0 + + + + + true + + + + + + 1 + 0 + + + + + + 280371.05910000001313165 + 5235855.97680000029504299 + 921292.37120000005234033 + 6101486.8776000002399087 + + + 5.56490831906716199 + 47.1412230134848258 + 15.57160476434985874 + 55.06013180269526686 + + authorities_enhanced_1c7a4c5f_eddf_46c7_a5a1_bf2d4c2a9cff + ./out/authorities_enhanced.geojson|geometrytype=Polygon + + + + Verkehrsverbünde und -unternehmen + + + PROJCRS["ETRS89 / UTM zone 32N",BASEGEOGCRS["ETRS89",ENSEMBLE["European Terrestrial Reference System 1989 ensemble",MEMBER["European Terrestrial Reference Frame 1989"],MEMBER["European Terrestrial Reference Frame 1990"],MEMBER["European Terrestrial Reference Frame 1991"],MEMBER["European Terrestrial Reference Frame 1992"],MEMBER["European Terrestrial Reference Frame 1993"],MEMBER["European Terrestrial Reference Frame 1994"],MEMBER["European Terrestrial Reference Frame 1996"],MEMBER["European Terrestrial Reference Frame 1997"],MEMBER["European Terrestrial Reference Frame 2000"],MEMBER["European Terrestrial Reference Frame 2005"],MEMBER["European Terrestrial Reference Frame 2014"],ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[0.1]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4258]],CONVERSION["UTM zone 32N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",9,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."],BBOX[38.76,6,84.33,12]],ID["EPSG",25832]] + +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + 2105 + 25832 + EPSG:25832 + ETRS89 / UTM zone 32N + utm + EPSG:7019 + false + + + + + + + dataset + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + + false + + + + + + + + + + + + + ogr + + + + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + 2 + + + + + + + 1 + 1 + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + 1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + 0 + generatedlayout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + "name" + + + + + + + + + true + <text-style textOpacity="1" fontWeight="50" previewBkgrdColor="255,255,255,255" fontSizeUnit="Point" fontKerning="1" textColor="0,0,0,255" fontLetterSpacing="0" fontWordSpacing="0" textOrientation="horizontal" forcedBold="0" fontFamily=".AppleSystemUIFont" blendMode="0" forcedItalic="0" namedStyle="Regular" fontUnderline="0" allowHtml="0" multilineHeight="1" fontSizeMapUnitScale="3x:0,0,0,0,0,0" fontStrikeout="0" fontItalic="0" fontSize="10" capitalization="0"> + <families/> + <text-buffer bufferSizeMapUnitScale="3x:0,0,0,0,0,0" bufferJoinStyle="128" bufferSize="1" bufferSizeUnits="MM" bufferBlendMode="0" bufferColor="255,255,255,255" bufferOpacity="1" bufferDraw="1" bufferNoFill="1"/> + <text-mask maskType="0" maskSize="0" maskOpacity="1" maskEnabled="0" maskSizeMapUnitScale="3x:0,0,0,0,0,0" maskSizeUnits="MM" maskJoinStyle="128" maskedSymbolLayers=""/> + <background shapeRadiiUnit="MM" shapeSizeY="0" shapeSizeUnit="MM" shapeOffsetX="0" shapeSVGFile="" shapeBorderColor="128,128,128,255" shapeOffsetUnit="MM" shapeJoinStyle="64" shapeFillColor="255,255,255,255" shapeSizeType="0" shapeOpacity="1" shapeRadiiY="0" shapeOffsetY="0" shapeOffsetMapUnitScale="3x:0,0,0,0,0,0" shapeSizeMapUnitScale="3x:0,0,0,0,0,0" shapeRadiiMapUnitScale="3x:0,0,0,0,0,0" shapeRotation="0" shapeDraw="0" shapeSizeX="0" shapeBorderWidthMapUnitScale="3x:0,0,0,0,0,0" shapeRotationType="0" shapeRadiiX="0" shapeBorderWidth="0" shapeBlendMode="0" shapeType="0" shapeBorderWidthUnit="MM"> + <symbol type="fill" alpha="1" name="fillSymbol" clip_to_extent="1" frame_rate="10" is_animated="0" force_rhr="0"> + <data_defined_properties> + <Option type="Map"> + <Option type="QString" name="name" value=""/> + <Option name="properties"/> + <Option type="QString" name="type" value="collection"/> + </Option> + </data_defined_properties> + <layer class="SimpleFill" enabled="1" pass="0" locked="0"> + <Option type="Map"> + <Option type="QString" name="border_width_map_unit_scale" value="3x:0,0,0,0,0,0"/> + <Option type="QString" name="color" value="255,255,255,255"/> + <Option type="QString" name="joinstyle" value="bevel"/> + <Option type="QString" name="offset" value="0,0"/> + <Option type="QString" name="offset_map_unit_scale" value="3x:0,0,0,0,0,0"/> + <Option type="QString" name="offset_unit" value="MM"/> + <Option type="QString" name="outline_color" value="128,128,128,255"/> + <Option type="QString" name="outline_style" value="no"/> + <Option type="QString" name="outline_width" value="0"/> + <Option type="QString" name="outline_width_unit" value="MM"/> + <Option type="QString" name="style" value="solid"/> + </Option> + <prop k="border_width_map_unit_scale" v="3x:0,0,0,0,0,0"/> + <prop k="color" v="255,255,255,255"/> + <prop k="joinstyle" v="bevel"/> + <prop k="offset" v="0,0"/> + <prop k="offset_map_unit_scale" v="3x:0,0,0,0,0,0"/> + <prop k="offset_unit" v="MM"/> + <prop k="outline_color" v="128,128,128,255"/> + <prop k="outline_style" v="no"/> + <prop k="outline_width" v="0"/> + <prop k="outline_width_unit" v="MM"/> + <prop k="style" v="solid"/> + <data_defined_properties> + <Option type="Map"> + <Option type="QString" name="name" value=""/> + <Option name="properties"/> + <Option type="QString" name="type" value="collection"/> + </Option> + </data_defined_properties> + </layer> + </symbol> + </background> + <shadow shadowUnder="0" shadowOffsetMapUnitScale="3x:0,0,0,0,0,0" shadowOffsetDist="1" shadowOffsetUnit="MM" shadowRadiusMapUnitScale="3x:0,0,0,0,0,0" shadowOpacity="0.69999999999999996" shadowDraw="0" shadowRadiusAlphaOnly="0" shadowScale="100" shadowOffsetGlobal="1" shadowRadiusUnit="MM" shadowColor="0,0,0,255" shadowBlendMode="6" shadowOffsetAngle="135" shadowRadius="1.5"/> + <dd_properties> + <Option type="Map"> + <Option type="QString" name="name" value=""/> + <Option name="properties"/> + <Option type="QString" name="type" value="collection"/> + </Option> + </dd_properties> +</text-style> + + + 1 + MM + 1 + 3 + + + 0 + + + 255 + 255 + 255 + 255 + 0 + 255 + 255 + + + false + + + + + + EPSG:7019 + + + m2 + meters + + + 5 + 2.5 + false + false + 1 + 0 + false + false + true + 0 + 255,0,0,255 + + + false + + + true + Default + 2 + MU + + false + + 1 + + + + + + + + + + + None + false + + + + + + 1 + false + conditions unknown + 90 + + + + 1 + + 8 + + false + + false + + 0 + + false + + + + + + + + false + + + + + false + + 5000 + + + + false + + + + + + + + + + + https://github.com/highsource/verbundkarte/ + DEU + + Verbundkarte + QGIS-Projekt zur interaktiven Visualisierung der Verbundkarte + + + + + + + + + + + Holger Bruch + 2023-02-26T11:52:18 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PROJCRS["ETRS89 / UTM zone 32N",BASEGEOGCRS["ETRS89",ENSEMBLE["European Terrestrial Reference System 1989 ensemble",MEMBER["European Terrestrial Reference Frame 1989"],MEMBER["European Terrestrial Reference Frame 1990"],MEMBER["European Terrestrial Reference Frame 1991"],MEMBER["European Terrestrial Reference Frame 1992"],MEMBER["European Terrestrial Reference Frame 1993"],MEMBER["European Terrestrial Reference Frame 1994"],MEMBER["European Terrestrial Reference Frame 1996"],MEMBER["European Terrestrial Reference Frame 1997"],MEMBER["European Terrestrial Reference Frame 2000"],MEMBER["European Terrestrial Reference Frame 2005"],MEMBER["European Terrestrial Reference Frame 2014"],ELLIPSOID["GRS 1980",6378137,298.257222101,LENGTHUNIT["metre",1]],ENSEMBLEACCURACY[0.1]],PRIMEM["Greenwich",0,ANGLEUNIT["degree",0.0174532925199433]],ID["EPSG",4258]],CONVERSION["UTM zone 32N",METHOD["Transverse Mercator",ID["EPSG",9807]],PARAMETER["Latitude of natural origin",0,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8801]],PARAMETER["Longitude of natural origin",9,ANGLEUNIT["degree",0.0174532925199433],ID["EPSG",8802]],PARAMETER["Scale factor at natural origin",0.9996,SCALEUNIT["unity",1],ID["EPSG",8805]],PARAMETER["False easting",500000,LENGTHUNIT["metre",1],ID["EPSG",8806]],PARAMETER["False northing",0,LENGTHUNIT["metre",1],ID["EPSG",8807]]],CS[Cartesian,2],AXIS["(E)",east,ORDER[1],LENGTHUNIT["metre",1]],AXIS["(N)",north,ORDER[2],LENGTHUNIT["metre",1]],USAGE[SCOPE["Engineering survey, topographic mapping."],AREA["Europe between 6°E and 12°E: Austria; Belgium; Denmark - onshore and offshore; Germany - onshore and offshore; Norway including - onshore and offshore; Spain - offshore."],BBOX[38.76,6,84.33,12]],ID["EPSG",25832]] + +proj=utm +zone=32 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs + 2105 + 25832 + EPSG:25832 + ETRS89 / UTM zone 32N + utm + EPSG:7019 + false + + + + + + + + + + + + + + + + + + + + + diff --git a/data/assignments.csv b/data/assignments.csv new file mode 100644 index 0000000..b86e962 --- /dev/null +++ b/data/assignments.csv @@ -0,0 +1,406 @@ +kreis,org +01001,NAH.SH +01002,VRK +01003,VWM +01004,NAH.SH +01051,NAH.SH +01053,HVV +01054,NAH.SH +01055,NAH.SH +01056,HVV +01057,VRK +01058,VRK +01059,NAH.SH +01060,HVV +01061,NAH.SH +01062,HVV +02000,HVV +03101,VRB +03102,VRB +03103,VRB +03151,VRB +03153,VRB +03154,VRB +03155,VSN +03157,VRB +03158,VRB +03159,VSN +03241,GVH +03251,VBN +03252,vhp +03254,ROSA +03255,VSN +03256,VLN +03257,VLS +03351,CeBus +03352,VNN +03353,HVV +03354,VNN +03355,HVV +03356,VBN +03357,VNN +03358,VNN +03359,HVV +03360,VNN +03361,VBN +03401,VBN +03402,VEJ +03403,VBN +03404,VOS +03405,VEJ +03451,VBN +03452,VEJ +03453,VGClo +03454,VGE +03454,bvE +03455,VEJ +03456,VGB +03457,VEJ +03458,VBN +03459,VOS +03460,VGV +03461,VBN +03462,VEJ +04011,VBN +04012,VBN +05111,VRR +05112,VRR +05113,VRR +05114,VRR +05116,VRR +05117,VRR +05119,VRR +05120,VRR +05122,VRR +05124,VRR +05154,VRR +05158,VRR +05162,VRR +05166,VRR +05170,VRR +05314,VRS +05315,VRS +05316,VRS +05334,AVV +05358,AVV +05362,VRS +05366,VRS +05370,AVV +05374,VRS +05378,VRS +05382,VRS +05512,VRR +05513,VRR +05515,VGM +05554,VGM +05558,VGM +05562,VRR +05566,VGM +05570,VGM +05711,VVOWL +05754,VVOWL +05758,VVOWL +05762,nph +05766,VVOWL +05770,VGM +05774,nph +05911,VRR +05913,VRR +05914,VRR +05915,VRL +05916,VRR +05954,VRR +05958,VRL +05962,VRL +05966,VGWS +05970,VGWS +05974,VRL +05978,VRL +06411,RMV +06412,RMV +06413,RMV +06414,VMW +06431,VRN +06432,RMV +06433,RMV +06434,RMV +06435,RMV +06436,RMV +06437,RMV +06438,RMV +06439,RMV +06440,RMV +06531,RMV +06532,RMV +06533,RMV +06534,RMV +06535,RMV +06611,RMV +06631,RMV +06632,RMV +06633,RMV +06634,RMV +06635,RMV +06636,RMV +07111,VRM +07131,VRM +07132,VRM +07133,RNN +07134,RNN +07135,VRM +07137,VRM +07138,VRM +07140,VRM +07141,VRM +07143,VRM +07211,VRT +07231,VRT +07232,VRT +07233,VRT +07235,VRT +07311,VRN +07312,VRN +07313,VRN +07314,VRN +07315,VMW +07316,VRN +07317,VRN +07318,VRN +07319,VRN +07320,VRN +07331,VRN +07332,VRN +07333,VRN +07334,VRN +07335,VRN +07336,VRN +07337,VRN +07338,VRN +07339,RNN +07340,VRN +08111,VVS +08115,VVS +08116,VVS +08117,VVS +08118,VVS +08119,VVS +08121,HNV +08125,HNV +08126,HNV +08127,KVSH +08128,VRN +08135,DING +08136,OAM +08211,KVV +08212,KVV +08215,KVV +08216,KVV +08221,VRN +08222,VRN +08225,VRN +08226,VRN +08231,VPE +08235,VGC +08236,VPE +08237,VGF +08311,RVF +08315,RVF +08316,RVF +08317,TGO +08325,VVRottweil +08326,VSB +08327,VSB +08335,VHB +08336,RVL +08337,WTV +08415,naldo +08416,naldo +08417,naldo +08421,DING +08425,DING +08426,DING +08435,bodo +08436,bodo +08437,naldo +09161,INV +09162,SWM +09163,ROS +09171,VGAÖ +09172,RVO +09173,MVV +09174,MVV +09175,MVV +09176,OMP +09177,MVV +09178,MVV +09179,MVV +09180,RVO +09181,LVG +09182,RVO +09183,VLMÜ +09184,MVV +09185,NDO +09186,PAF +09187,RVO +09188,MVV +09189,RVO +09190,RVO +09261,LAVV +09262,swp +09263,RBO +09271,RBO +09272,RBO +09273,RBO +09274,LAVV +09275,RBO +09276,RBO +09277,RBO +09278,RBO +09279,RBO +09361,VGN +09362,RVV +09363,WEN +09371,VGN +09372,CHA +09373,VGN +09374,RBO +09375,RVV +09376,RBO +09377,RBO +09461,VGN +09462,VGN +09463,COB +09464,HOF +09471,VGN +09472,VGN +09473,OVF +09474,VGN +09475,RBO +09476,OVF +09477,OVF +09478,VGN +09479,RBO +09561,VGN +09562,VGN +09563,VGN +09564,VGN +09565,VGN +09571,VGN +09572,VGN +09573,VGN +09574,VGN +09575,VGN +09576,VGN +09577,VGN +09661,VAB +09662,OVF +09663,VVM +09671,VAB +09672,OVF +09673,OVF +09674,OVF +09675,VVM +09676,VAB +09677,VVM +09678,OVF +09679,VVM +09761,AVTV +09762,OMP +09763,OMP +09764,OMP +09771,AVTV +09772,AVTV +09773,OMP +09774,OMP +09775,DING +09776,OMP +09777,OMP +09778,OMP +09779,OMP +09780,mona +10041,saarVV +10042,saarVV +10043,saarVV +10044,saarVV +10045,saarVV +10046,saarVV +11000,VBB +12051,VBB +12052,VBB +12053,VBB +12054,VBB +12060,VBB +12061,VBB +12062,VBB +12063,VBB +12064,VBB +12065,VBB +12066,VBB +12067,VBB +12068,VBB +12069,VBB +12070,VBB +12071,VBB +12072,VBB +12073,VBB +13003,VVW +13004,VWM +13071,VMO +13072,VVW +13073,VVR +13074,VWM +13075,VMO +13076,VWM +14511,VMS +14521,VMS +14522,VMS +14523,VVV +14524,VMS +14612,VVO +14625,VVO +14625,ZVON +14626,ZVON +14627,VVO +14628,VVO +14713,LVB +14729,MDV +14730,MDV +15001,dessau +15002,MDV +15003,marego +15081,SAW +15082,ABI +15083,marego +15084,MDV +15085,VTO +15086,marego +15087,MSH +15088,MDV +15089,marego +15090,SDL +15091,NWB +16051,VMT +16052,VMT +16053,VMT +16054,IVRPV +16055,VMT +16056,VGW +16061,ew +16062,NDH +16063,VGW +16064,RS +16065,RS +16066,IVRPV +16067,VMT +16068,VWG +16069,IVRPV +16070,IVRPV +16071,VMT +16072,KomBus +16072,IVRPV +16073,KomBus +16074,VMT +16075,KomBus +16076,VGLG +16076,VMT +16077,MDV diff --git a/data/authorities.csv b/data/authorities.csv new file mode 100644 index 0000000..96e0b8f --- /dev/null +++ b/data/authorities.csv @@ -0,0 +1,107 @@ +org,name,wikidata,type,contact_email,contact_phone +MSH,Mansfeld-Südharz,Q6092,district,, +SAW,Altmarkkreis Salzwedel,Q6061,district,, +ABI,Anhalt-Bitterfeld,Q6071,district,, +AVTV,Augsburger Verkehrs- und Tarifverbund,Q760574,agency,, +AVV,Aachener Verkehrsverbund,Q300763,agency,, +bodo,Bodensee-Oberschwaben Verkehrsverbund,Q889680,agency,, +CeBus,CeBus,Q1052172,agency,, +CHA,Cham,Q10424,district,, +COB,SÜC Bus & Aquaria,Q2377826,utility,, +dessau,Dessauer Verkehrsgesellschaft,Q1200902,utility,, +vhp,Verkehrsgesellschaft Hameln-Pyrmont,Q46285860,agency,, +DING,Donau-Iller-Nahverkehrsverbund,Q315403,agency,info@ding.eu, +ew,Eichsfeldwerke,Q1302220,utility,, +VGF,Verkehrs-Gemeinschaft Landkreis Freudenstadt (war fds),Q1689141,company,, +VGLG,Verkehrsgemeinschaft des Landkreises Greiz,Q81440717,company,, +GVH,Großraum-Verkehr Hannover,Q1549516,agency,, +ROSA,ROSA Tarifverbund,Q77041777,agency,, +HNV,Heilbronner Hohenloher Haller Nahverkehr,Q1594788,agency,, +HOF,Stadtwerke Hof,Q63623957,utility,, +HVV,Hamburger Verkehrsverbund,Q896916,agency,, +INV,Ingolstadt,Q3004,city,, +IVRPV,Bus & Bahn Thüringen e.V. (ehemals Interessenverband Regionaler Personenverkehr Südthüringen),Q1666021,agency,, +KomBus,KomBus,Q1779744,agency,, +KVSH,KreisVerkehr Schwäbisch Hall,Q1504893,agency,, +KVV,Karlsruher Verkehrsverbund,Q1733986,agency,, +LAVV,Landshuter Verkehrsverbund (LAVV),Q65952782,agency,, +LVB,Leipziger Verkehrsbetriebe,Q884166,agency,, +LVG,Landsberger Verkehrsgemeinschaft,Q1673799,company,, +marego,Magdeburger Regionalverkehrsverbund,Q1883891,agency,, +MDV,Mitteldeutscher Verkehrsverbund,Q1742463,agency,, +mona,Mona Allgäu,Q29043552,agency,, +MVV,Münchner Verkehrs- und Tarifverbund,Q259000,agency,, +NAH.SH,Nahverkehrsverbund Schleswig-Holstein,Q15825147,agency,, +NDH,Nordhausen,Q7858,district,, +NDO,Landkreis Neuburg-Schrobenhausen,Q10493,agency,, +nph,nph Nahverkehrsbund Paderborn/Höxter,-,agency,, +NWB,Wittenberg,Q6075,district,, +OAM,OstalbMobil,Q2034809,agency,, +OMP,Omnipart,-,agency,, +OVF,Omnibusverkehr Franken,Q1254382,agency,, +PAF,Stadtbus Pfaffenhofen,Q7596528,agency,, +RBO,Regionalbus Ostbayern,Q2138285,agency,, +RMV,Rhein-Main-Verkehrsverbund,Q314042,agency,, +RNN,Rhein-Nahe Nahverkehrsverbund,Q1245949,agency,, +ROS,Stadtverkehr Rosenheim,Q45060296,agency,, +RS,RS,Q1358980,company,, +RVF,Regio-Verkehrsverbund Freiburg,Q972037,agency,, +RVL,Regio Verkehrsverbund Lörrach,Q2138145,agency,, +RVO,Regionalverkehr Oberbayern,Q2138493,agency,, +RVV,Regensburger Verkehrsverbund,Q2137458,agency,, +saarVV,Saarländischer Verkehrsverbund,Q2209244,agency,, +SDL,Stendal,Q6057,district,, +SWM,Stadtwerke München,Q882871,utility,, +swp,Verkehrsbetriebsgesellschaft Passau (VBP),Q15852663,agency,, +TGO,Tarifverbund Ortenau,Q1525084,agency,, +naldo,Verkehrsverbund Neckar-Alb-Donau,Q1467217,agency,, +VBB,Verkehrsverbund Berlin-Brandenburg,Q315451,agency,, +VBN,Verkehrsverbund Bremen/Niedersachsen,Q1306245,agency,, +VEJ,Verkehrsverbund Ems-Jade,Q1324337,agency,, +VGB,Verkehrsgemeinschaft Grafschaft Bentheim,Q2516212,company,, +VGC,Verkehrsgesellschaft Bäderkreis Calw,Q1493646,agency,, +VGClo,Verkehrsgemeinschaft Landkreis Cloppenburg,Q2516220,company,, +VGE,Verkehrsgemeinschaft Emsland-Süd,Q2516209,company,, +bvE,Busverkehr Emsland-Mitte/Nord,Q1017814,agency,, +VGM,Verkehrsgemeinschaft Münsterland,Q2516237,company,, +VGN,Verkehrsverbund Großraum Nürnberg,Q2516463,agency,, +VGV,Verkehrsgesellschaft der Stadt Velbert,Q2516302,agency,, +VGW,Verkehrsgemeinschaft Wartburgregion,Q64431601,company,, +VGWS,Verkehrsgemeinschaft Westfalen-Süd,Q2516267,company,, +VHB,Verkehrsverbund Hegau-Bodensee,Q1484666,agency,, +VLN,Verkehrsservice Landkreis Nienburg/Weser,Q2516286,agency,, +VLS,Verkehrsgemeinschaft Landkreis Schaumburg,Q2516231,company,, +VMO,Verkehrsgemeinschaft Müritz-Oderhaff,Q2516241,company,, +VMS,Verkehrsverbund Mittelsachsen,Q1145755,agency,, +VMT,Verkehrsverbund Mittelthüringen,Q2516468,agency,, +VNN,Verkehrsgemeinschaft Nordost-Niedersachsen,Q2516245,company,, +VOS,Verkehrsgemeinschaft Osnabrück,Q2516249,company,, +VPE,Verkehrsverbund Pforzheim-Enzkreis,Q2516474,agency,, +VRB,Verkehrsverbund Region Braunschweig,Q2514431,agency,, +VRK,Verkehrsverbund Region Kiel,Q2516477,agency,, +VRL,Verkehrsgemeinschaft Ruhr-Lippe,Q1229874,company,, +VRM,Verkehrsverbund Rhein-Mosel,Q2516481,agency,, +VRN,Verkehrsverbund Rhein-Neckar,Q1553051,agency,, +VRR,Verkehrsverbund Rhein-Ruhr,Q448199,agency,, +VRS,Verkehrsverbund Rhein-Sieg,Q896041,agency,, +VRT,Verkehrsverbund Region Trier,Q2516480,agency,, +VSB,Verkehrsverbund Schwarzwald-Baar,Q2516487,agency,, +VSN,Verkehrsverbund Süd-Niedersachsen,Q1360635,agency,, +VTO,Verkehrs- und Tarifgemeinschaft Ostharz,Q2516092,company,, +VAB,Verkehrsgemeinschaft am Bayerischen Untermain,Q2516264,company,, +VGAÖ,Verkehrsgemeinschaft Altötting,Q1269865,company,, +VLMÜ,Verkehrsgemeinschaft Landkreis Mühldorf,,company,RBO.Muehldorf@deutschebahn.com,+49(0)8631/990218 +VMW,Verkehrsverbund Mainz-Wiesbaden,Q2516467,agency,, +VVM,Verkehrsverbund Mainfranken,Q2516466,agency,, +VVO,Verkehrsverbund Oberelbe,Q1426445,agency,, +VVOWL,Zweckverband Verkehrsverbund OWL,Q231863,agency,poststelle@vvowl.de-mail.de,+49(0)521/3294330 +VVR,Verkehrsgesellschaft Vorpommern-Rügen,Q23787863,agency,, +VVRottweil,Verkehrsverbund Rottweil,Q1582791,agency,, +VVS,Verkehrs- und Tarifverbund Stuttgart,Q2516108,agency,, +VVV,Verkehrsverbund Vogtland,Q2516490,agency,, +VVW,Verkehrsverbund Warnow,Q2516492,agency,, +VWG,Verwaltungsgesellschaft des ÖPNV Sömmerda,Q1801295,agency,, +VWM,Verkehrsgemeinschaft Westmecklenburg,Q2516262,company,, +WEN,Stadtverkehr Weiden (Oberpfalz),-,agency,, +WTV,Waldshuter Tarifverbund,Q2541897,agency,, +ZVON,Verkehrsverbund Oberlausitz-Niederschlesien,Q2516483,agency,, diff --git a/merge.py b/merge.py new file mode 100644 index 0000000..661f0e4 --- /dev/null +++ b/merge.py @@ -0,0 +1,82 @@ +from SPARQLWrapper import get_sparql_dataframe +# for now, import SPARQLWrapper as well, to redefine __agent__: +import SPARQLWrapper + +import geopandas as gpd +import os +import pandas as pd +import urllib.request + +USER_AGENT = "github.com/highsource/verbundkarte/0.0.1" +CACHE_DIR = '.cache' +OUT_DIR = 'out' +# WFS Service: https://sgx.geodatenzentrum.de/wfs_vg250-ew?REQUEST=GetCapabilities&SERVICE=WFS +VG250_URL = 'https://sgx.geodatenzentrum.de/wfs_vg250-ew?REQUEST=GetFeature&SERVICE=WFS&VERSION=2.0.0&outputFormat=json&typeNames=vg250-ew:vg250_krs&srsName=EPSG:4326&' +AUTHORITIES_FILE = 'data/authorities.csv' +ASSIGNMENTS_FILE = 'data/assignments.csv' +CACHED_VG250_PATH = os.path.join(CACHE_DIR, 'vg250_krs.json') +VG250_GEOFAKTOR_LAND_MIT_STRUKTUR = 4 +ENHANCED_AUTHORITIES_PATH = os.path.join(OUT_DIR, 'authorities_enhanced.geojson') + +def assert_dir_exists(path): + if not os.path.exists(path): + os.mkdir(path) + +def download_if_not_cached(path, url): + if not os.path.exists(path): + urllib.request.urlretrieve(url, path) + +def setup(): + assert_dir_exists(OUT_DIR) + assert_dir_exists(CACHE_DIR) + download_if_not_cached(CACHED_VG250_PATH, VG250_URL) + +def get_wikidata_frame(): + + endpoint = "https://query.wikidata.org/sparql" + + q = """ + SELECT ?td ?tdLabel ?officalWebsite ?shortName ?twitterUserName ?linkedInOrgId + WHERE + { + # ?td isInstance transit district + ?td wdt:P31 wd:Q7835189. + ?td wdt:P17 wd:Q183. + OPTIONAL {?td wdt:P856 ?officalWebsite} + OPTIONAL {?td wdt:P1813 ?shortName} + OPTIONAL {?td wdt:P2002 ?twitterUserName} + OPTIONAL {?td wdt:P4264 ?linkedInOrgId} + SERVICE wikibase:label { bd:serviceParam wikibase:language "de". } + } + """ + + # TODO In case https://github.com/RDFLib/sparqlwrapper/pull/225 is merged + # these two lines may be replaced by the param version below + SPARQLWrapper.__agent__ = USER_AGENT + df = get_sparql_dataframe(endpoint, q) + # df = get_sparql_dataframe(endpoint, q, USER_AGENT) + + df.td = df.td.str.replace('http://www.wikidata.org/entity/' , '', regex=True) + return df + +def merge(): + """ + Joins authorities, their operating areas and corresponding shapes + and writes the resulting file to ENHANCED_AUTHORITIES_PATH. + """ + authorities = pd.read_csv(AUTHORITIES_FILE) + # Import assignments. As district ID may have leading zeros, need to set as str explicitly + assignments = pd.read_csv(ASSIGNMENTS_FILE, dtype = {'kreis': str}) + + all_districts = gpd.read_file(CACHED_VG250_PATH) + gf4_districts = all_districts[(all_districts.gf==VG250_GEOFAKTOR_LAND_MIT_STRUKTUR)] + + # Merge districts with assignments. Note, that to keep GeoDataFrame, we use merge called on gf4_districts + assignments_with_geometries = gf4_districts.merge(assignments, right_on='kreis', left_on='ars').filter(items=['kreis','org','geometry']) + assignments_with_geometries_grouped_by_org = assignments_with_geometries.dissolve(by='org') + authorities_with_geometries = assignments_with_geometries_grouped_by_org.merge(authorities, how='outer', on='org') + authorities_with_geometries = authorities_with_geometries.merge(get_wikidata_frame(), how='left', left_on='wikidata', right_on='td') + authorities_with_geometries.to_file(ENHANCED_AUTHORITIES_PATH, driver='GeoJSON') + +setup() +merge() diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..8c6ff8b --- /dev/null +++ b/requirements.txt @@ -0,0 +1,19 @@ +# main dependenncies +geopandas~=1.0.1 +sparql-dataframe~=0.4 + +# transitive dependencies +certifi~=2025.1.31 +numpy~=2.2.2 +packaging~=24.2 +pandas~=2.2.3 +pyogrio~=0.10.0 +pyparsing~=3.2.1 +pyproj~=3.7.0 +python-dateutil~=2.9.0.post0 +pytz~=2025.1 +rdflib~=7.1.3 +shapely~=2.0.7 +six~=1.17.0 +SPARQLWrapper~=2.0.0 +tzdata~=2025.1