Code Monkey home page Code Monkey logo

maplibre-gl-geocoder's Introduction

MapLibre Organization

https://www.maplibre.org/

This repository contains various documents that define the MapLibre Organization such as the Charter, our Code of Conduct, the list of Voting Members, and more.

You also find here the results of past Governing Board elections.

Formatting

Markdown files in this repo are formatted with markdownlint. If you have formatting problems you can sometimes fix them with:

npx markdownlint-cli *.md --fix

maplibre-gl-geocoder's People

Contributors

adrianababakanian avatar amplifiyer avatar andrewharvey avatar antony avatar arcanemachine avatar cmtoomey avatar danswick avatar dependabot[bot] avatar drewbo avatar hy9be avatar josh-major avatar jseppi avatar katydecorah avatar malwoodsantoro avatar mapbox-danny avatar mapsam avatar mblomdahl avatar mzdraper avatar oliverbienert avatar orivelton avatar rafraser avatar samanpwbb avatar sethvincent avatar sheridanvk avatar thaddmt avatar tmcw avatar tretuna avatar tristen avatar wipfli avatar zavety avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

maplibre-gl-geocoder's Issues

Events library dependency

Hi! I had a problem with an app I built that uses maplibre-gl-geocoder. The component wouldn't work because the events library required in index.js is not listed in the dependencies in package.json.

I added the dependency to my project's package.json, and now it works. I'm not sure if I'm doing something wrong, but maybe maplibre-gl-geocoder's package.json should have "events" in its dependencies list?

Thank you for your work on this library, though - it's great!

Pin stays on the map when results of subsequent queries return

Hi! thanks for the amazing project. I have encountered what I think is a bug, because i think it should be irrelevant to my choice of geocoder (Nominatim).

To reproduce the bug:

  1. search for "NUS singapore" (I have a map of singapore), press enter.
  2. click on the one that says National University of Singapore from the dropdown list, it zooms in closer to the place;
  3. click enter again and the map zooms in even closer;
  4. search for the next query "NUH singapore" (do not clear manually clear search box), which has 2 results from the drop down. But when I zoom out the map, the pin for National University of Singapore is still there.

Please see attached screen recording for the reference.

Thank you!

maplibre-geocoder.mp4

Geocoder requiring input to be cleared before searching for entire set of places after a single result search

Dupe of aws-amplify/amplify-ui#1797

Bug was discovered in the amplify-ui repo which wraps the maplibre-gl-geocoder component

Please describe your bug.

I'm using the Geocoder component, and I'm seeing an issue where I can't search for another set of places after clicking on a single result from the search result container. The issue does not happen if I clear the input of the search box before performing a search for the set of places so it is a minor bug.

What's the expected behaviour?

The search box should continue to allow searching for a new set of places, after clicking on a single result, without having to clear the content of the search box.

Help us reproduce the bug!

Type in "ATM" in the search box and hit "Enter" on the keyboard
The map should display markers for a set of ATMs
Click on the first result from the search result container
The map should display a single marker for the first result's ATM
Highlight the entire text and type in "Grocery Store" (highlighting entire text and overwriting it with "Grocery Store" will prevent it from clearing the input)
Hit "Enter" on the keyboard
Nothing will happen

Every link to "Carmen GeoJSON" format reference is broken in API.md and in JSDocs in source.

Every instance of Carmen GeoJSON in the source code JSDocs and in API.md points to a 404 page on Github. I tried Googling for a definition of Carmen GeoJSON format but came up empty.

The source code example of the getPlaceById function in the geocoderApi parameter contains what I think may be a definition of a Carment GeoJSON feature as used in this project:

{
  type: string, 
  geometry: {
    type: string, 
    coordinates: [number]
  }, 
  place_name: string, 
  text: string, 
  center: [number] 
}[]

Am I correct in assuming everything is required except text?
Am I correct in assuming that the first type always has to be 'Feature' and geometry.type always has to be 'Point'?

NOTE: API.md incorrectly states that getPlaceById should return an array of text/placeId suggestions.

Documentation bug for auto-suggest

The documentation is wrong both in README.md (where it doesn't mention searchByPlaceId) and index.js (where it mentions getByPlaceId which doesn't exist in the code, also has the wrong returned values for both getByPlaceId and getSuggestions).

This adds unnecessary pain to developers, since they need to reverse-geocode the code to understand how to implement search with auto suggest.

Customise marker information when clicked

Hi, I'm new to this API. Is it possible to customise popup information about a place when the marker is clicked? For instance, here my address is too long and it won't be able to fix into the default popup box.

image

Thanks a lot!

options.popup defaults to "false", but documented as "true"

The options.popup parameter to MaplibreGeocoder is defaulted to false while the JSDoc definition and reference in API.md specify the default value of options.popup as true.

We can resolve this by either:

  • Setting the default value of options.popup to true (L87)
  • Updating the JSDoc description (L47) and the reference in API.md (L99) to a default value of false

Updating reference to the default value has the benefit of not impacting users' applications if they upgrade to the version which contains the fix.

_onKeyDown not working when map is inside custom web component

When using maplibre In a custom web component, the selection for the value doesn't work properly. The Active element in the shadow root isn't the input element itself. My recommendation would be to use the value of this._inputEl because there's already a reference to it.
Screen Shot 2021-12-20 at 12 01 09

Dependency nanoid is vulnerable & needs to be upgraded

The project depends on nanoid version 2.0.1 which is affected by CVE-2021-23566.

This is showing up in vulnerability scans of several packages that depend on yours. Would it be possible to update the dependency to nanoid >=3.1.31?

I've cloned the branch, updated the dependency to version ^3.2.0, and ran the tests and they're all passing so it should be a quick fix.

If you could share the npm version used by this project I'd be happy to open a PR to do the update, I'm asking this because I don't want to break your current lock files as a result of the update.

Form submission blocked by clear button

When placing the Geocoder component inside a form, the form cannot be submitted using the Enter key. This issue arises because the clear button lacks a type="button" attribute, causing it to default to type="submit". Consequently, it is triggered during form submission and cancels the submission within the _clear function.

Idea: able to have zoom option override bbox

When I am searching for some points, for example 'Paris'. It zooms in really far, more than I would like.

It seems like the geocoding result is a point, but still has a bbox property?

If so, I think it would be a good idea if specified by the user, to have the zoom option be able to override a feature's bbox

Typescript types

Does this package has typescript types?
Is it possible to add support for typescript?

Search with MGRS

Can i Search with MGRS coordinates in reverse geocode ?

and if it's posable how to implement it in react

Run tests in CI

Currently we don't run any tests in CI:

- name: Install build dependencies
run: |
npm install
- name: Publish
run: |
npm publish --access=public --non-interactive
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}

In the current situation, we might end up publishing something broken. I would recommend to run the tests right before npm publish and create a separate github actions workflow which runs the tests against all pull requests.

add documentation for package dependencies if it is used in vite

I had an error of TypeError: EventEmitter is not a constructor when I use it with vite.

I found the below stackoverflow,
https://stackoverflow.com/questions/69717406/typeerror-eventemitter-is-not-a-constructor-at-new-mapboxgeocoder

then, I found the following dependencies are necessary to use this geocoder.

npm i -D events @types/events @types/node

I am not sure how many people are using vite with this geocoder, but this dependencies info can be documented somewhere in the repo. I think vite is becoming more popular.

Suggest nominatim example

Here is what I did to make it works with nominatim:

let GeoApi = {
    forwardGeocode: async(config) => {
        const features = []
        console.log('features:', features)
        return new Promise(async(resolve) => {
            try {
                let request = "https://nominatim.openstreetmap.org/search?q=" + config.query + "&format=geojson&polygon_geojson=1&addressdetails=1"
                const response = await fetch(request);
                const geojson = await response.json();
                for (let feature of geojson.features) {
                    let center = [
                        feature.bbox[0] + (feature.bbox[2] - feature.bbox[0]) / 2,
                        feature.bbox[1] + (feature.bbox[3] - feature.bbox[1]) / 2
                    ];
                    let point = {
                        type: "Feature",
                        geometry: {
                            type: "Point",
                            coordinates: center
                        },
                        place_name: feature.properties.display_name,
                        properties: feature.properties,
                        text: feature.properties.display_name,
                        place_type: ["place"],
                        center: center
                    }
                    features.push(point)
                }
            } catch (e) {
                console.error(`Failed to forwardGeocode with error: ${e}`);
            }
            resolve({
                features: features,
            });
        });
    },
};

Enjoy !

What are the urls for script and stylesheet ?

In Mapbox, I need to use below urls for adding a Geocoder control to the map on an html page, so what is the equivalent urls for maplibr-gl-geocoder of below:

<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.7.2/mapbox-gl-geocoder.min.js'></script>

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.