我有一个人的lat和lon,我需要找到这个人在特定多边形的内部或外部。因为我使用KML矢量叠加来显示openlayers谷歌地图上的区域。请咨询
答案 0 :(得分: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);
}
我担心我不能给你完整的代码,但你明白了。