Openlayers 显示坐标点

     Openlayers 显示坐标点的两种方法:           

 

 

                 //1、显示所有坐标点

                  $(“input[@type=hidden][@id $= ‘hidGeom’]”).each(function() {                     
                            var point = this.value;
                            var features = new OpenLayers.Format.WKT( map.baseLayer.projection).read(point);
                            vectors.addFeatures(features);
                   }); 

 

 

                // 2、鼠标点击时显示单个点 
                $(“a[@id $= ‘lnkName’]”).click(function(){
            
                         var pointID = this.id.replace(‘lnkName’, “hidGeom”);
     
                         var point = document.getElementById(pointID).value;

                         var features = new OpenLayers.Format.WKT(map.baseLayer.projection).read(point);
     
                         if(features) 
                          {
                                   if(features.constructor != Array)
                                    {
                                           features = [features];
                                    }

                                    vectors.destroyFeatures();

                                    vectors.addFeatures(features);
                            }
                   })

转载自:https://blog.csdn.net/liumqj/article/details/6550143

You may also like...