-1

我有一个人的纬度和经度,我需要找到这个人在特定多边形的内部或外部。因为我使用 KML 矢量叠加在 openlayers 谷歌地图上显示区域。请建议

4

1 回答 1

1
In your init: function()

//Awesome design
style = { styleMap: new OpenLayers.StyleMap({ "temporary": style})};

//Make the layer        
this.selectLayer = new OpenLayers.Layer.Vector("draw_polygon", style);

//Make the control
this.selectControl = new OpenLayers.Control.DrawFeature(this.selectLayer, OpenLayers.Handler.Polygon, {featureAdded: this.toggleDraw});

whatever.map.addControl(this.selectControl);

Then:

toggleDraw: function(feature) {
//Do some magic with finding if the uses is inside (example) search_options.viewModel.searchForPerson(feature);
}

恐怕我不能给你完整的代码,但你明白了。

于 2013-02-20T09:45:35.743 回答