Skip to content

Commit fb605e6

Browse files
committed
gbfs map fix
1 parent 05ca29f commit fb605e6

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

src/app/screens/Feed/Feed.functions.tsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Box, Typography } from '@mui/material';
33
import {
44
type GTFSFeedType,
55
type GBFSVersionType,
6+
type GBFSFeedType,
67
} from '../../services/feeds/utils';
78
import { type LatLngTuple } from 'leaflet';
89
import { type GeoJSONData, type GeoJSONDataGBFS } from '../../types';
@@ -192,36 +193,35 @@ export function computeBoundingBox(
192193
}
193194

194195
export const getBoundingBox = (
195-
feed: GTFSFeedType,
196+
feed: GTFSFeedType | GBFSFeedType ,
196197
): LatLngTuple[] | undefined => {
197-
if (feed == undefined || feed.data_type !== 'gtfs') {
198+
if (feed == undefined || feed.data_type === 'gtfs_rt') {
198199
return undefined;
199-
}
200-
const gtfsFeed: GTFSFeedType = feed;
200+
};
201201
if (
202-
gtfsFeed.bounding_box?.maximum_latitude == undefined ||
203-
gtfsFeed.bounding_box?.maximum_longitude == undefined ||
204-
gtfsFeed.bounding_box?.minimum_latitude == undefined ||
205-
gtfsFeed.bounding_box?.minimum_longitude == undefined
202+
feed.bounding_box?.maximum_latitude == undefined ||
203+
feed.bounding_box?.maximum_longitude == undefined ||
204+
feed.bounding_box?.minimum_latitude == undefined ||
205+
feed.bounding_box?.minimum_longitude == undefined
206206
) {
207207
return undefined;
208208
}
209209
return [
210210
[
211-
gtfsFeed.bounding_box.minimum_latitude,
212-
gtfsFeed.bounding_box.minimum_longitude,
211+
feed.bounding_box.minimum_latitude,
212+
feed.bounding_box.minimum_longitude,
213213
],
214214
[
215-
gtfsFeed.bounding_box.minimum_latitude,
216-
gtfsFeed.bounding_box.maximum_longitude,
215+
feed.bounding_box.minimum_latitude,
216+
feed.bounding_box.maximum_longitude,
217217
],
218218
[
219-
gtfsFeed.bounding_box.maximum_latitude,
220-
gtfsFeed.bounding_box.maximum_longitude,
219+
feed.bounding_box.maximum_latitude,
220+
feed.bounding_box.maximum_longitude,
221221
],
222222
[
223-
gtfsFeed.bounding_box.maximum_latitude,
224-
gtfsFeed.bounding_box.minimum_longitude,
223+
feed.bounding_box.maximum_latitude,
224+
feed.bounding_box.minimum_longitude,
225225
],
226226
];
227227
};

src/app/screens/Feed/FeedView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ export default async function FeedView({
128128
? (feed as GBFSFeedType)?.source_info?.producer_url
129129
: undefined; // Simplified
130130

131-
const boundingBox = getBoundingBox(feed as GTFSFeedType);
131+
const boundingBox = getBoundingBox(feed);
132132

133133
let latestDataset: LatestDatasetFull;
134134
if (feed.data_type === 'gtfs') {

0 commit comments

Comments
 (0)