I am using an external geocoder with the Mapbox geocoder widget.
The results return and are concatenated to the standard geocoder results correctly.
When clicking on a result in the geocoder tool menu, it navigates correctly to the point identified in the list.
It also throws a 422 error, and I am not sure why.
This is the code where I implement it:
externalGeocoder: async (queryString) => {
const filters = {
geom_column: 'geom',
filter: `cast(busstopid as text) like '${queryString}%' or address like upper('${queryString}%')`,
precision: 9,
columns: 'address as place_name, address as text, busstopid',
id_column: 'internal_id',
limit: 5,
};
// get data from both the GTFS feed and MIIPS if possible
const generalData = await utilities.getData(`${URL.base}/v1/geojson/gtfs_data?`, filters);
const miipsData = await utilities.getData(
`${URL.base}/mama/miips/read_serial_number_geocoder/${queryString}`
);
if (miipsData.features) {
return generalData.features.concat(miipsData.features);
} else {
return generalData.features;
}
}
This is the object the external geocoder is creating:
I looked into the repo and tried to discern from the error and payload what I was doing wrong. The results seem to work correctly, but it also seems like it is trying to use the external result with the standard geocoder somehow, which seems wrong. I am not sure how to drill down into this further to better diagnose the behavior, but any help would be most appreciated.
This is the code where I implement it:
This is the object the external geocoder is creating:
I looked into the repo and tried to discern from the error and payload what I was doing wrong. The results seem to work correctly, but it also seems like it is trying to use the external result with the standard geocoder somehow, which seems wrong. I am not sure how to drill down into this further to better diagnose the behavior, but any help would be most appreciated.