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

maptalks.mapresty

v0.3.0

Published

A MapResty's client for maptalks.js.

Downloads

3

Readme

maptalks.mapresty

CircleCI Appveyor

A MapResty's client for maptalks.js.

Examples

Usage

In Browser

<script type="text/javascript" src="path/to/maptalks.js"></script>
<script type="text/javascript" src="path/to/maptalks.mapresty.js"></script>
<script type="text/javascript">
var featureQuery = new maptalks.FeatureQuery({
    //...
});
</script>

ES Modules

import * as maptalks from 'maptalks';
//plugin's classes should be imported directly like
import { FeatureQuery, SpatialFilter } from 'maptalks.mapresty';

const filter = new SpatialFilter(
    geometry, 
    SpatialFilter['RELATION_INTERSECT'], 
    maptalks.CRS.BD09LL
);

const featureQuery = new FeatureQuery({
    spatialFilter : filter,
    //...
});

Feature Query

var featureQuery = new maptalks.FeatureQuery({
    'host': engineHost,//host of mapresty
    'port': enginePort,//port
    'mapdb': mapdb     //spatial db name
});

var spatialFilter = new maptalks.SpatialFilter(
    geometry, //geometry, can be a maptalks.Geometry or a geojson object

    //RELATION_CONTAIN, RELATION_DISJOINT, RELATION_OVERLAP, RELATION_TOUCH,
    //RELATION_WITHIN, RELATION_INTERECTNOTCONTAIN, RELATION_CONTAINCENTER, RELATION_CENTERWITHIN
    SpatialFilter['RELATION_INTERSECT'], 
    maptalks.CRS.BD09LL //CRS of spatial filter
);

//query data
featureQuery.query({
    'page' : 0,
    'count': 100,
    'layer': ['layer1', 'layer2'],
    'queryFilter': {
        'returnGeometry': true,
        'spatialFilter' : spatialFilter, // spatialFilter

        //maptalks.CRS.GCJ02, maptalks.CRS.EPSG4490, maptalks.CRS.EPSG3857, maptalks.CRS.EPSG4326
        'resultCRS': maptalks.CRS.BD09LL,
        'condition': cond,      //properties condition
        'resultFields': ['*']   //fields to return,['*'] means all the fields
    },
    //additional url parameters
    'urlParameters' : 'token=xxxx'
},function(err, data) {
    if (err) {
        alert('error when querying data', err);
        return;
    }
    //....
});

//count data
featureQuery.count({
    'layer': ['layer1', 'layer2'],
    'queryFilter': {
        'spatialFilter' : spatialFilter, // spatialFilter
        'condition': cond,      //properties condition
    },
    //additional url parameters
    'urlParameters' : 'token=xxxx'
},function(err, count) {
    if (err) {
        alert('error when querying data', err);
        return;
    }
    //....
});

Spatial Query

var topo = new maptalks.TopoQuery({
    'host' : engineHost,
    'port' : enginePort
});

//query if source is spatial related with targets in the given relation
topo.relate({
    'source' : sourceGeo,     //source
    'targets' : [targetGeo],  //geometries to query relation
    'relation'   : SpatialFilter['RELATION_INTERSECT'], //relation
    'urlParameters' : 'token=xxxx'
}, function (err, data) {
    if (err) {
        alert('error when querying relation', err);
        return;
    }
    //...
});

//query buffer of geometries
topo.buffer({
    'geometries' : [geometry],
    'distance'   : 100,      //buffer distance, in meters
    'urlParameters' : 'token=xxxx'
},function(err, data) {
    if (err) {
        alert('error when querying buffer', err);
        return;
    }
    //....
});