feat: adjust according to the Brunswick city

This commit is contained in:
dancingCycle 2023-12-20 13:56:49 +01:00
parent b8879d5571
commit 082f112015
4 changed files with 15 additions and 132 deletions

View File

@ -14,15 +14,15 @@ const corner1 = L.latLng(-60, -180),
export default function MapEntities( { entities } ) {
//console.log('map-entities:MapEntities: entities.lngth: ' + entities.length);
/*center map in the middle of RVB*/
const mapCenter = [52.16594, 10.52673];
/*center map at Node: Umweltzentrum Braunschweig (3650315388)*/
const mapCenter = [52.2671189, 10.5221905];
const mapRef = useRef();
useEffect(() => {
const map = L.map( mapRef.current, {attributionControl: true})
.setView( mapCenter, 9).
.setView( mapCenter, 12).
setMaxBounds( bounds );
L.tileLayer(

View File

@ -22,20 +22,12 @@ export default function App(){
<Route path='/bike-ride' element={<EntityOsm
address={config.ADDRESS + 'nwr[amenity=bicycle_parking][bike_ride]["bike_ride"!="no"]' + config.AREA }
title='B+R Stations'/>}/>
{/**TODO Group stops!
<Route path='/bus-stop' element={<EntityOsm
address={ config.ADDRESS + 'nwr[highway=bus_stop]' + config.AREA }
title='Bus Stops'/>}/>
*/}
<Route path='/charging-station' element={<EntityOsm
address={ config.ADDRESS + 'nwr[amenity=charging_station]' + config.AREA }
title='Charging Stations'/>}/>
<Route path='/park-ride' element={<EntityOsm
address={ config.ADDRESS + 'nwr["park_ride"!="no"]["park_ride"]' + config.AREA }
title='P+R Stations'/>}/>
<Route path='/pid' element={<EntityOsm
address={ config.ADDRESS + 'nwr[passenger_information_display=yes]' + config.AREA }
title='Passenger Information Displays'/>}/>
<Route path='/second-hand' element={<EntityOsm
address={ config.ADDRESS + 'nwr[shop=second_hand]' + config.AREA }
title='Second Hand Shops'/>}/>
<Route path='/taxi' element={<EntityOsm
address={ config.ADDRESS + 'nwr[amenity=taxi]' + config.AREA }
title='Taxi Stations'/>}/>
@ -45,12 +37,6 @@ export default function App(){
<Route path='/ticket-office' element={<EntityOsm
address={ config.ADDRESS + 'nwr[shop=ticket]["tickets:public_transport"!=no]' + config.AREA }
title='Ticket Offices'/>}/>
<Route path='/train-station' element={<EntityOsm
address={ config.ADDRESS + 'nwr[railway=station][usage!=tourism]' + config.AREA }
title='Train Stations'/>}/>
<Route path='/train-halt' element={<EntityOsm
address={ config.ADDRESS + 'nwr[railway=halt][usage!=tourism]' + config.AREA }
title='Train Halts'/>}/>
</Routes>
<p>

View File

@ -1,153 +1,50 @@
import React, { useState, useEffect } from 'react'
import React from 'react'
import { Link} from 'react-router-dom';
import { get } from '../utils/request';
export default function Home(){
const [bikeRideCount, setBikeRideCount] = useState('loading...');
//TODO Group stops! const [busStopCount, setBusStopCount] = useState('loading...');
const [chargingStationCount, setChargingStationCount] = useState('loading...');
const [parkRideCount, setParkRideCount] = useState('loading...');
const [pidCount, setPidCount] = useState('loading...');
const [taxiCount, setTaxiCount] = useState('loading...');
const [ticketMachineCount, setTicketMachineCount] = useState('loading...');
const [ticketOfficeCount, setTicketOfficeCount] = useState('loading...');
const [trainStationCount, setTrainStationCount] = useState('loading...');
const [trainHaltCount, setTrainHaltCount] = useState('loading...');
useEffect(() => {
/*effect goes here*/
const address = 'https://overpass-api.de/api/interpreter?data=[out:json][timeout:60];relation(4189512);map_to_area;';
const area = '(area);out body center qt;';
////console.log('StationProfile:useEffect() address: ' + address);/
//bike ride
get(address + 'nwr[amenity=bicycle_parking][bike_ride]["bike_ride"!="no"]' + area)
.then(data => {
setBikeRideCount(data.elements.length);
});
//TODO Group stops!
/**
//bus stop
get(address + 'nwr[highway=bus_stop]' + area)
.then(data => {
setBusStopCount(data.elements.length);
});
*/
//charging station
get(address + 'nwr[amenity=charging_station]' + area)
.then(data => {
setChargingStationCount(data.elements.length);
});
//park ride
get(address + 'nwr["park_ride"!="no"]["park_ride"]' + area)
.then(data => {
setParkRideCount(data.elements.length);
});
//passenger information display
get(address + 'nwr[passenger_information_display=yes]' + area)
.then(data => {
setPidCount(data.elements.length);
});
//taxi
get(address + 'nwr[amenity=taxi]' + area)
.then(data => {
setTaxiCount(data.elements.length);
});
//ticket machines
get(address + 'nwr[amenity=vending_machine][vending=public_transport_tickets]' + area)
.then(data => {
setTicketMachineCount(data.elements.length);
});
//ticket offices
get(address + 'nwr[shop=ticket]["tickets:public_transport"!=no]' + area)
.then(data => {
setTicketOfficeCount(data.elements.length);
});
//train stations
get(address + 'nwr[railway=station][usage!=tourism]' + area)
.then(data => {
setTrainStationCount(data.elements.length);
});
//train halts
get(address + 'nwr[railway=halt][usage!=tourism]' + area)
.then(data => {
setTrainHaltCount(data.elements.length);
});
}, []);
return (
<>
<ul>
<li>
<Link to={'/bike-ride'} >
<button>
{bikeRideCount}&nbsp;Bike and ride (B+R) stations
</button>
</Link>
</li>
<li>
<Link to={'/charging-station'} >
<button>
{chargingStationCount}&nbsp;Charging Stations
Bike and ride (B+R) stations
</button>
</Link>
</li>
<li>
<Link to={'/park-ride'} >
<button>
{parkRideCount}&nbsp;Park and ride (P+R) stations
Park and ride (P+R) stations
</button>
</Link>
</li>
<li>
<Link to={'/pid'} >
<Link to={'/second-hand'} >
<button>
{pidCount}&nbsp;Passenger Information Displays
Second hand shops
</button>
</Link>
</li>
<li>
<Link to={'/taxi'} >
<button>
{taxiCount}&nbsp;Taxi stations
Taxi stations
</button>
</Link>
</li>
<li>
<Link to={'/ticket-machine'} >
<button>
{ticketMachineCount}&nbsp;Ticket machines
Ticket machines
</button>
</Link>
</li>
<li>
<Link to={'/ticket-office'} >
<button>
{ticketOfficeCount}&nbsp;Ticket offices
</button>
</Link>
</li>
<li>
<Link to={'/train-station'} >
<button>
{trainStationCount}&nbsp;Train Stations
</button>
</Link>
</li>
<li>
<Link to={'/train-halt'} >
<button>
{trainHaltCount}&nbsp;Train Halts
Ticket offices
</button>
</Link>
</li>

View File

@ -1,5 +1,5 @@
export default {
API: 'https://v1rvb.api.swingbe.de/',
ADDRESS: 'https://overpass-api.de/api/interpreter?data=[out:json][timeout:60];relation(4189512);map_to_area;',
ADDRESS: 'https://overpass-api.de/api/interpreter?data=[out:json][timeout:60];relation(62531);map_to_area;',
AREA: '(area);out body center qt;',
};