finds.dev← search

// the find

hujiulong/gcoord

★ 3,308 · TypeScript · MIT · updated Jun 2026

地理坐标系转换工具

gcoord solves a specific, annoying problem: China's map providers each use their own obfuscated coordinate system (WGS-84 from GPS, GCJ-02 for AMap/Google China, BD-09 for Baidu), and mixing them up puts your pins in the wrong city block. This library handles the math for converting between them, including GeoJSON bulk transforms. If you're not building something that touches Chinese maps, you have no use for this.

The GeoJSON support is the real value — passing a FeatureCollection through and getting all coordinates transformed in one call beats looping manually. Zero runtime dependencies and a 3 KB gzip footprint mean it won't argue with your bundle budget. The alias system (AMap, BMap, Baidu as named constants) means you can express intent in the code rather than remembering which numeric CRS code maps to what. Test coverage runs against real city coordinate fixtures, not synthetic data, which is the right call for floating-point math you can't easily reason about.

The in-place mutation of GeoJSON objects is a footgun — `transform(geojson, ...)` silently modifies the object you passed in, which breaks immutability assumptions and will surprise anyone who reuses the input. There's no inverse-transform shorthand or round-trip utility, so you can't easily verify your transforms didn't drift. The supported CRS list stops at Chinese web maps and Web Mercator; anything outside that scope (UTM zones, country-specific datums) gets punted to proj4js with no bridging help. Changelog exists but sparse — hard to tell if the math formulas have been updated as the official specs evolved.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →