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

acdc-gis-utils

v0.1.4

Published

Requires following dependencies: <br/> "bootstrap": "^4.4.1" or "@angular/material": "^8.0.0" <br/> "leaflet": "^1.6.0", <br/> "terraformer": "^1.0.10", <br/> "terraformer-wkt-parser": "^1.2.1"

Downloads

54

Readme

Gis Utils (Location picker input, gis utils service containing utility functions like converting GeoJSON and WKT formats)

Requires following dependencies: "bootstrap": "^4.4.1" or "@angular/material": "^8.0.0" "leaflet": "^1.6.0", "terraformer": "^1.0.10", "terraformer-wkt-parser": "^1.2.1"

Angular versions support - 6,7+

See Demo for Bootstrap See Demo for Material

Latest updates

16 April 2020 new configs (readonly, expandOnInputClick, showCloseBtn) 03 March 2020 angular 9 compatibility 29 February 2020 alpha version

Install

1. Install dependencies with npm


npm install bootstrap (or npm install @angular/material)
npm install leaflet
npm install terraformer
npm install terraformer-wkt-parser

2. Install package with npm


npm install acdc-gis-utils

3. Import leaflet and bootstrap css files (in case of material import material style). Example importing bootstrap with angular.json:


"styles": [
    "src/styles.css",
    "./node_modules/bootstrap/dist/css/bootstrap.min.css",
    "./node_modules/leaflet/dist/leaflet.css"
]

4. Import gis module in your project's root module app.module.ts:


import { AcdcGisUtils } from 'acdc-gis-utils';

imports: [
    AcdcGisUtils
]

Usage

1. LocationPickerInputComponent (bootstrap style):


<form #form="ngForm">
    <location-picker-input 
        initialLatitude="41.73033005046653" 
        initialLongitude="44.81666564941407" 
        initialZoom="10" 
        [defaultShowMap]="false"
        mapHeight="200px"
        mapWidth="100%"
        [inputFIeldTpl]="inputFIeldTpl"
        [closeOnChoose]="true"
        [readonly]="false"
        [expandOnInputClick]="true"
        [showCloseBtn]="false"
        name="location" [(ngModel)]="location"></location-picker-input>
</form>

<!-- your custom input template (if not provided default will be used) -->
<ng-template #inputFIeldTpl let-props="props" let-onInputClick="onInputClick" let-onChooseLocation="onChooseLocation" let-propagateChange="propagateChange">
    <div class="input-group">
        <input type="text" class="form-control" name="locationValue" (click)="onInputClick(props)" [(ngModel)]="props.locationValue" placeholder="Click on map to choose location..." aria-label="Location" readonly>
        <div class="input-group-append">
        <span class="input-group-text" style="cursor: pointer;" (click)="onChooseLocation(props)">
            <svg aria-hidden="true" class="acdc-svg" viewBox="0 0 512 512"><path fill="currentColor" d="M505.04 442.66l-99.71-99.69c-4.5-4.5-10.6-7-17-7h-16.3c27.6-35.3 44-79.69 44-127.99C416.03 93.09 322.92 0 208.02 0S0 93.09 0 207.98s93.11 207.98 208.02 207.98c48.3 0 92.71-16.4 128.01-44v16.3c0 6.4 2.5 12.5 7 17l99.71 99.69c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.59.1-33.99zm-297.02-90.7c-79.54 0-144-64.34-144-143.98 0-79.53 64.35-143.98 144-143.98 79.54 0 144 64.34 144 143.98 0 79.53-64.35 143.98-144 143.98zm.02-239.96c-40.78 0-73.84 33.05-73.84 73.83 0 32.96 48.26 93.05 66.75 114.86a9.24 9.24 0 0 0 14.18 0c18.49-21.81 66.75-81.89 66.75-114.86 0-40.78-33.06-73.83-73.84-73.83zm0 96c-13.26 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"></path></svg>
        </span>
        </div>
    </div>
</ng-template>

Available attributes: initialLatitude - initial latitude for map initial state initialLongitude - initial longitude for map initial state initialZoom - initial zoom for map initial state defaultShowMap - show map by default (if false user can toggle map using input field trigger button) mapHeight - map height mapWidth - map width inputFIeldTpl - template for input field (if not provided default will be used) closeOnChoose - close map after location was chosed readonly - edit or view states expandOnInputClick - expand or not on input click event showCloseBtn - show close button on map

2. LocationPickerInputComponent (material style providing tpl is required as default is bootstrap style):


<form #form="ngForm">
    <location-picker-input 
            initialLatitude="41.73033005046653" 
            initialLongitude="44.81666564941407" 
            initialZoom="10" 
            [defaultShowMap]="true"
            mapHeight="200px"
            mapWidth="400px"
            [inputFIeldTpl]="inputFIeldTpl"
            [closeOnChoose]="false"
            [readonly]="false"
            [expandOnInputClick]="true"
            [showCloseBtn]="false"
            name="location" [(ngModel)]="location"></location-picker-input>
</form>

<!-- your custom input template (required in material case as default is bootstrap style) -->
<ng-template #inputFIeldTpl let-props="props" let-onInputClick="onInputClick" let-onChooseLocation="onChooseLocation" let-propagateChange="propagateChange">
    <mat-form-field>
      <mat-label>Location</mat-label>
      <input matNativeControl type="text" class="form-control" (click)="onInputClick(props)" name="locationValue" [(ngModel)]="props.locationValue" placeholder="Click on map to choose location..." aria-label="Location" readonly>
      <button type="button" matSuffix mat-button>
        <span class="input-group-text" style="cursor: pointer;" (click)="onChooseLocation(props)">
          <svg aria-hidden="true" class="acdc-svg" viewBox="0 0 512 512"><path fill="currentColor" d="M505.04 442.66l-99.71-99.69c-4.5-4.5-10.6-7-17-7h-16.3c27.6-35.3 44-79.69 44-127.99C416.03 93.09 322.92 0 208.02 0S0 93.09 0 207.98s93.11 207.98 208.02 207.98c48.3 0 92.71-16.4 128.01-44v16.3c0 6.4 2.5 12.5 7 17l99.71 99.69c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.59.1-33.99zm-297.02-90.7c-79.54 0-144-64.34-144-143.98 0-79.53 64.35-143.98 144-143.98 79.54 0 144 64.34 144 143.98 0 79.53-64.35 143.98-144 143.98zm.02-239.96c-40.78 0-73.84 33.05-73.84 73.83 0 32.96 48.26 93.05 66.75 114.86a9.24 9.24 0 0 0 14.18 0c18.49-21.81 66.75-81.89 66.75-114.86 0-40.78-33.06-73.83-73.84-73.83zm0 96c-13.26 0-24-10.75-24-24 0-13.26 10.75-24 24-24s24 10.74 24 24c0 13.25-10.75 24-24 24z"></path></svg>
        </span>
      </button>
    </mat-form-field>
</ng-template>

3. Import and use gis utils service:


import { AcdcGisUtilsService } from 'acdc-gis-utils';

constructor( private acdcGisUtilsService: AcdcGisUtilsService ) {}

anyMethod(){

    // converting GeoJSON and WKT formats

	let wkt = 'POINT(44.78576660156251 41.72161808379742)';
    let geom = this.acdcGisUtilsService.fromWkt(wkt);
    console.log(geom);
    let convertedWkt = this.acdcGisUtilsService.toWkt(geom);
    console.log(convertedWkt);

    let polygonWkt = "POLYGON((44.758768 41.710671,44.761058 41.711622,44.764684 41.709894,44.763599 41.708147,44.758571 41.707254,44.757073 41.708111,44.757602 41.709593,44.758768 41.710671))";
    let polygonGeom = this.acdcGisUtilsService.fromWkt(polygonWkt);
    console.log(polygonGeom);
    let convertedPolygonWkt = this.acdcGisUtilsService.toWkt(polygonGeom);
    console.log(convertedPolygonWkt);
	
}