最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Node.js library for geospatial operations - Stack Overflow

programmeradmin1浏览0评论

I am developing an application where I have geospatial polygons like this:

var polygon = [{"lat": -19.939323, "lng": -43.928983},
               {"lat": -19.939747, "lng": -43.933103},
               {"lat": -19.947291, "lng": -43.93497},
               {"lat": -19.948138, "lng": -43.931451},
               {"lat": -19.943882, "lng": -43.930292}]

I will receive a coordinate to say if is inside, or not, the polygon. I found, in Geometry Library of Google Maps Javascript API, a function who does exactly the same thing: containsLocation(point:LatLng, polygon:Polygon)

But this must be server-side, using node.js, is there a way to use this function on node.js, or better, is there a good library who does that?

I am developing an application where I have geospatial polygons like this:

var polygon = [{"lat": -19.939323, "lng": -43.928983},
               {"lat": -19.939747, "lng": -43.933103},
               {"lat": -19.947291, "lng": -43.93497},
               {"lat": -19.948138, "lng": -43.931451},
               {"lat": -19.943882, "lng": -43.930292}]

I will receive a coordinate to say if is inside, or not, the polygon. I found, in Geometry Library of Google Maps Javascript API, a function who does exactly the same thing: containsLocation(point:LatLng, polygon:Polygon)

But this must be server-side, using node.js, is there a way to use this function on node.js, or better, is there a good library who does that?

Share Improve this question asked Jun 27, 2012 at 20:33 Caio PimentaCaio Pimenta 611 silver badge4 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 15

There are a few node modules, such as geolib:

Library to provide basic geospatial operations like distance calculation, conversion of decimal coordinates to sexagesimal and vice versa, etc.

which have an equivalent function to determine coordinates relative to a polygon.

References

  • geolib Github repo
  • geojson-js-utils Github repo
  • geojson-vt Github repo

Use Turf Library for any geospatial operations. Turf is an open source JavaScript library that allows you to do spatial operations in the browser and node.js.

发布评论

评论列表(0)

  1. 暂无评论