npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@open-pioneer/coordinate-search

v0.8.0

Published

This package provides a UI component to search for entered coordinates in the choosen projection.

Downloads

70

Readme

@open-pioneer/coordinate-search

This package provides a UI component which allow users to search for coordinates in the map and provides component that is an input field for coordinates.

Usage coordinate search

To integrate the coordinate search in your app, insert the following snippet:

<CoordinateSearch mapId="map_id" />

Configuration

To define the selectable projections, set the optional projections property:

<CoordinateSearch
    mapId="map_id"
    projections={[
        {
            label: "EPSG:25832",
            value: "EPSG:25832",
            precision: 2
        },
        {
            label: "WGS 84",
            value: "EPSG:4326"
        },
        {
            label: "Web Mercator",
            value: "EPSG:3857"
        }
    ]}
/>

The optional property precision allows to specify the number of display digits (default: 3).

If no projections are specified, Web Mercator (EPSG:3857) and WGS 84 (EPSG:4326) are the default options.

Listening to events

To listen to the events onSelect and onClear, provide optional callback functions to the component.

In case of the onSelect event, you can access the entered coordinate from the parameter CoordinatesEvent. The onSelect event gets called if a valid input is entered or if the selected projection is changed after entering an input.

With the onClear option, you can set a callback function that gets called if the clear button is clicked.

<CoordinateSearch
    mapId="map_id"
    onSelect={(event: CoordinatesEvent) => {
        // do something
    }}
    onClear={() => {
        // do something
    }}
/>

Usage coordinate input

To integrate the coordinate input component in your app, insert the following snippet:

<CoordinateInput mapId="map_id" />

Configure projections

To define the selectable projections, set the optional projections property:

<CoordinateInput
    mapId="map_id"
    projections={[
        {
            label: "EPSG:25832",
            value: "EPSG:25832",
            precision: 2
        },
        {
            label: "WGS 84",
            value: "EPSG:4326"
        },
        {
            label: "Web Mercator",
            value: "EPSG:3857"
        }
    ]}
/>

The optional property precision allows to specify the number of display digits (default: 3).

If no projections are specified, Web Mercator (EPSG:3857) and WGS 84 (EPSG:4326) are the default options.

Set the input value

To set the value of the input field from outside the component, set the optional input property of type Coordinate.

The coordinates have to be in the projection of the map.

If the value changes, the onSelect function is triggered (see below).

<CoordinateInput mapId="map_id" input={[761166, 6692084]} />

Configure the placeholder

To set the placeholder of the input field from outside the component, use the optional placeholder property of type Coordinate or string.

Common usage for a string input is a supportive text like "Enter coordinates here".

A Coordinate input can be used for example for showing the coordinates of a selected geometry or the current mouse position.

The Coordinates have to be in the projection of the map.

<CoordinateInput mapId="map_id" placeholder={[700000, 6000000]} />
<CoordinateInput mapId="map_id" placeholder={"Enter coordinates here"} />

Listening to events

To listen to the events onSelect and onClear, provide optional callback functions to the component.

In case of the onSelect event, you can access the entered coordinate from the parameter CoordinatesEvent. The onSelect event gets called if you enter the input, if value of the input property changes or if the selected projection is changed after entering an input.

With the onClear option, you can set a callback function that gets called if the clear button is clicked.

<CoordinateInput
    onSelect={(event: CoordinatesEvent) => {
        // do something
    }}
    onClear={() => {
        // do something
    }}
/>

License

Apache-2.0 (see LICENSE file)