javascript中的地理空间查询 [英] geospatial queries in javascript

查看:105
本文介绍了javascript中的地理空间查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个允许我进行地理空间查询的javascript库。我知道OpenLayers和GoogleMaps,但这两个不支持联合交叉等等。

I'm looking for a library in javascript that would allow me to make geospatial queries. I know about OpenLayers and GoogleMaps, but this two do not support things like union intersection and so on.

+----+
|    |
|  +-+--+
+--+-+  |
   |    |
   +----+

    +----+
    |    |
    |    +--+
    +--+    |
       |    |
       +----+


推荐答案


更新2014-04-29:查看草坪,看起来很有希望

JSTS 可以做浏览器中几何对象的联合。 JSTS与openlayers库集成,它扩展了openlayers几何类(例如OpenLayers.Geometry.Polygon),因此它们能够进行几何操作。示例:

JSTS can do unions of geometric objects in the browser. JSTS integrates with the openlayers library and it extends openlayers geometric classes (e.g. OpenLayers.Geometry.Polygon) so they are capable of geometric operations. Example:

>> var poly1 = OpenLayers.Geometry.Polygon.createRegularPolygon(
                                   new OpenLayers.Geometry.Point(0.0,0.0), 2, 5);
>> var poly2 = OpenLayers.Geometry.Polygon.createRegularPolygon(
                                   new OpenLayers.Geometry.Point(1.0,1.0), 2, 4);
>> var poly_u = poly1.union(poly2);
>> var poly_d = poly1.difference(poly2);
>> print(poly_u);
POLYGON((1.5667154718422638 -0.4142135623730949,1.1755705045849463 -1.618033988749895,
  -1.1755705045849465 -1.6180339887498947,-1.902113032590307 0.618033988749895,
  -0.41421356237309503 1.6990562312593451,-0.4142135623730949 2.414213562373095,
   2.414213562373095 2.414213562373095,2.414213562373095 -0.4142135623730949,
   1.5667154718422638 -0.4142135623730949))

Geoscript JS 非常好,如果你想在JS中进行服务器端几何操作。

Geoscript JS is nice if you want to do serverside geometric operations in JS.

这篇关于javascript中的地理空间查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆