1.0.2 • Published 3 years ago

amap-geoparser v1.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

AMap GeoParser

GeoParser for AMap(高德地图)

A minimal parser extract from AMap ui/geo/DistrictExplorer.

Usage

npm install amap-geoparser
import GeoParser from 'amap-geoparser'

const parser = new GeoParser()
const areaNode = parser.loadAreaNode(/** adcode **/, /** amap json data **/)

// const parentFeature = areaNode.getParentFeature()
// const subFeatures = areaNode.getSubFeatures()

If you only want to use the parser, you can juse use parseGeoData method.

import { parseGeoData } from 'amap-geoparser'

const geoData = parseGeoData(/** amap json data **/)

API

AreaNode

APIdescription
constructor(adcode: number, data: object);
static getPropsOfFeature(feature): any
static getAdcodeOfFeature(feature): any
static doesFeatureHasChildren(feature): boolean
getIdealZoom(): number
getSubFeatureByIndex(index: number): any
getSubFeatureByAdcode(adcode: number): any
getAdcode(): number
getName(): string
getChildrenNum(): number
getSubFeatures(): any[]
getParentFeature(): any
getParentFeatureInPixel(): any