🚨 Shai-Hulud Strikes Again:More than 500 packages and 700+ versions compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

@kartotherian/postgis-vt-util

Package Overview
Dependencies
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kartotherian/postgis-vt-util

PostGIS helper functions for making vector tiles

latest
npmnpm
Version
0.3.1
Version published
Maintainers
8
Created
Source

postgis-vt-util

postgres helper functions for making vector tiles in Mapbox Studio

z

Given the !scale_denominator! mapnik token, returns a zoom level. Lets you to control at which zoom levels features appear.

Arguments: !scale_denominator! [mapnik token]

Example:

( SELECT
    some, attributes,
    geom_generalized
  FROM your_table
  where z(!scale_denominator!) in (10,11,12)
  union ALL
  SELECT
    some, attributes,
    geom_not_generalized
  FROM your_table
  where z(!scale_denominator!) >= 13
) as data

labelgrid

De-duplicates features based on a given grid size, letting you control feature density. All features are snapped to a grid, but only 1 feature per grid cell is returend when selecting DISTINCT ON the labelgrid function.

Arguments: geometry [geometry], grid size [an integer that divides evenly into 256], !pixel_width! [mapnik token]

Example:

( SELECT
    disctinct on(labelgrid(geom, 128, !pixel_width!))
    some, other, attributes
  FROM your_table
) AS data

linelabel

Select only those line geometries long enough to be labeled; drops all line geometries too short for mapnik to place a label. Linelabel compares line length to the length of a user-supplied label field.

Arguments: zoom [integer], label [text field], geometry [geometry]

Example:

( SELECT
    name, geom
  FROM your_table
  WHERE linelabel(z(!scale_denominator!), name, geom)
) AS data

merc_buffer

Wrapper for ST_Buffer that adjusts distance by latitude to approximate real-world measurements. Assumes input geometries are Web Mercator and input distances are real-world meters. Accuracy decreases for larger buffer distances and at extreme latitudes.

Arguments: geometry [geometry], distance in meters [numeric]

merc_dwithin

Wrapper for ST_DWithin that adjusts distance by latitude to approximate real-world measurements. Assumes input geometries are Web Mercator and input distances are real-world meters. Accuracy decreases for larger distances and at extreme latitudes.

Arguments: geometry a [geometry], geometry b [geometry], distance in meters [numeric]

merc_length

Wrapper for ST_Length that adjusts distance by latitude to approximate real-world measurements. Assumes input geometries are Web Mercator. Accuracy decreases for larger y-axis ranges of the input.

Arguments: geometry [geometry]

tile_bbox

Given a Web Mercator tile ID as (z, x, y), returns a bounding-box geometry of the area covered by that tile.

Arguments: zoom_level [integer], x_tile [integer], y_tile [integer]

FAQs

Package last updated on 30 Jul 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts