Coder Social home page Coder Social logo

Comments (13)

ro-ka avatar ro-ka commented on July 20, 2024

No problem, there are no n00b questions. ;)

It doesn’t return the entered string – the purpose is to always get a geocoded place from the library to use. When using only the inputted string in the geocoding, the chances of a successful geocode are very low as Google already suggests the known stuff.

Or do you have examples of places that don’t get suggested but can be geocoded by Google?

Related to #72.

from react-geosuggest.

oyeanuj avatar oyeanuj commented on July 20, 2024

@ro-ka thanks for the response!

I was coming from it more from a UX point of view, where the following three cases might happen and that I would still like to save the input:

  1. Mis-spellings.
  2. Places not in Google - this is mainly a problem internationally, where either address or place name doesn't show up in Google. From my personal experience, half the places I look up in India might not show up accurately but people around know the place (and hence important to store the place name).
  3. New places, or ones which have psuedo names that they might want to use (again known and understood to the relevant groups even if they can't be geo-coded).

This option would enable the library to provide for input when there are other issues with Google libraries.

What do you think?

from react-geosuggest.

ro-ka avatar ro-ka commented on July 20, 2024

I understand the case. The main purpose is to return a geocoded place to work with. I’m not sure how to integrate the non-geocoding found case.

Possibilities:

  • Default is a strict mode that will only return geocoded places.
  • A non-strict mode could do this:
    • Geocode the input string on enter when nothing is selected.
    • Return geocoded result if something got found.
    • Return without non-geocoded place in case nothing could be geocoded.

Does that make sense?

from react-geosuggest.

oyeanuj avatar oyeanuj commented on July 20, 2024

Yes, I think that would work well as it keeps it backward-compatible but provides options to those in need :)

The only question that I have -

Geocode the input string on enter when nothing is selected.

Wondering if the interaction should only be bound to enter. What would you think of having the last row always be the address or a label like "Custom Address" and clicking on that gives you the input string as well?

from react-geosuggest.

ro-ka avatar ro-ka commented on July 20, 2024

Hm, good question. As there was the request for a submit button in #72, which is the same thing we are talking about here, I’m not sure what to prefer.

A submit button seems to be more standard, but can be confusing. When selecting a suggestion from the dropdown, the submit button is irritating as it doesn’t have any extra functionality. But custom address can be irritation, too.

Will think about that…

from react-geosuggest.

iam4x avatar iam4x commented on July 20, 2024

I'm using react-geosuggest to validate complete street_address, here's my code:

const filterResults = ({ types }) => !types.includes('street_address')

function SearchLocation(props: Props) {
  const { placeholder, onChange, initialValue, children, precise } = props

    return (
      <div className='search-location'>
        <Geosuggest
          placeholder={ placeholder }
          onSuggestSelect={ (value) => handleChange(value, onChange) }
          initialValue={ initialValue || emptyString }
          types={ precise ? [ 'address' ] : [] }
          skipSuggest={ precise ? filterResults : noop } />
        { children }
      </div>
    )
}

The filter is pretty aggressive and the user must enter an address starting with a number, would be great to display a message when there's no suggestions 👍

Right now, I've wrapped the component to do it myself. If you are ready for a PR @ro-ka I can do it 👍

from react-geosuggest.

oyeanuj avatar oyeanuj commented on July 20, 2024

The filter is pretty aggressive and the user must enter an address starting with a number, would be great to display a message when there's no suggestions

That message could be a custom string formed from the input itself.

+1 to @iam4x volunteering for the PR!

But custom address can be irritation, too.
@ro-ka Increasingly, I see this behavior in a lot of places which have address auto-complete since there will always be inputs not on google.

from react-geosuggest.

ro-ka avatar ro-ka commented on July 20, 2024

@iam4x If you like to add a PR that would be great! :)

from react-geosuggest.

ro-ka avatar ro-ka commented on July 20, 2024

Any progress on this?

from react-geosuggest.

dimafeldman avatar dimafeldman commented on July 20, 2024

I needed a similar functionality too, so here's my PR:
added support for providing a callback when no results found, by simply passing the onSuggestNoResults prop
#167

from react-geosuggest.

oyeanuj avatar oyeanuj commented on July 20, 2024

This is awesome, thanks @dimafeldman!

from react-geosuggest.

ro-ka avatar ro-ka commented on July 20, 2024

The PR #167 got merged.

from react-geosuggest.

oyeanuj avatar oyeanuj commented on July 20, 2024

@ro-ka Revisiting this, as I was testing some old code and realized that the #167 by @dimafeldman (thank you for that!) only solves part of the issue. That PR allows the developer to get the string entered through the callback function (onSuggestNoResults).

But the other part of this issue was what I think @iam4x, @amanofscience (in #72) and I were also referring to: some way to have a custom label/message in the dropdown which can say "Add [user-input]", clicking on which would fire the callback to onSuggestNoResults added by @dimafeldman.

I was thinking something along the lines of getSuggestLabel, like getSuggestLabelForNoResult? Or do you think we can somehow use that method in this case?

from react-geosuggest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.