-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
location field: expose record type and id from geocode response in the onLayerSelected callback #33
Comments
In the same vein, we noticed that the custom stop icon is not shown next to geocoder results on the stops layer. We'd like to be able to change the icon in accordance with the mocks we're working towards. One pattern that worked well for us with this last revision is the way the new With this request I also understand the possible risk of tightly coupling your component to specific geocoder layers (which is something I assume you don't want) so it may require a slightly different implementation than Here's that dynamic icon component we provided to /* eslint-disable react/jsx-props-no-spreading */
import React from 'react';
import PropTypes from 'prop-types';
import * as Styled from './styled';
const LocationTypeIcon = ({ locationType, ...props }) => {
return {
to: <Styled.DestinationIcon {...props} />,
from: <Styled.OriginIcon {...props} />
}[locationType];
};
LocationTypeIcon.propTypes = {
locationType: PropTypes.oneOf(['to', 'from'])
};
LocationTypeIcon.defaultProps = {
locationType: 'from'
};
export default LocationTypeIcon; |
@fpurcell, I think what may be best is to pass through the raw geocode result data that applications can then parse. @randolphjones there is already a slot for a custom icon for a stop icon. It is the |
@evansiroky Thanks for the quick turn on that. I think we can work with the geocoder result. Appreciate you adding that. In regards to the icon. This is the design that we're working from for displaying geocoder results. stopOptionIcon={<Styled.ButtonListIcon type="stop" />} |
Oh, wait that stopOptionIcon only applies to nearby stops if you're including those from a nearby stops search. Try using |
Thanks for the extra guidance @evansiroky I now see the If I run into any other issues I'll let you know. Thanks again. |
See #13
Would like calling app to have access to data from the geocoder beyond name and coordinate. In Pelias there are 2 properties that carry needed information. The 'layers' property describes what type of record (e.g., a stop vs. an address vs. a venue, etc..). The 'id' property, for certain records, contains valuable information, like stop_id and agency_id (for layers=stops). Eventually there will be a 'routes' layer, which will contain a route_id, etc... The use of those 2 properties (type and id) might work well, since all records in Pelias have those fields, plus guessing other geocoders have similar values (e.g., should make things universal). That said, open to suggestions on other solutions and ideas to communicate needed information back to the calling app.
The text was updated successfully, but these errors were encountered: