How to form URL for to Export and download Selected features as KML formate

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

How to form URL for to Export and download Selected features as KML formate

mano3688

I get selected features when i draw polygon using this polygonSelectFeatureHighlightControl control.
But i want to export selected features as kml when i draw polygon.
                       
If i write code like this
window.open(wfsProtocol.url+'?service=WFS&srs=EPSG:4326&version='+wfsProtocol.version+'&request=GetFeature&outputFormat=OGR-KML&typeName='+stateLayer.name);
                       
i get kml file for full layer,but i need kml file for selected features when i draw polygon.
                       
so please reply which param i want add in the window URL(how to form URL) to download kml file for selected features.
                       
        Thanks to all
                        by Manoharan G
My code:
  //My projection
  var projWGS84 = new OpenLayers.Projection("EPSG:4326");
  var projSphericalMercator = new OpenLayers.Projection("EPSG:900913");
  var wfsProtocol = new OpenLayers.Protocol.WFS({
        url: "http://localhost:8080/geoserver/wfs",
        featureType:stateLayer.name,
        featureNS:"http://kcubeconsulting.com/geobrowser",
        srsName: "EPSG:4326",
        version: "1.0.0"
                                //outputFormat: "OGR-KML"
         
        });
                       
                       
 
 
  var selectFeaturevectorLayer = new OpenLayers.Layer.Vector("selectFeaturevectorLayer");
 
   var vectors=new OpenLayers.Layer.Vector("vectors");
 
   //My control for to highlight selected features when i draw polygon
   
  var polygonSelectFeatureHighlightControl=new OpenLayers.Control.DrawFeature(
        vectors, OpenLayers.Handler.Polygon,{
        map:map,
        eventListeners: {
                "featureadded": function(event) {
                featureHighlightWindow.show();
                event.feature.geometry.transform(new OpenLayers.Projection("EPSG:900913"),new OpenLayers.Projection("EPSG:4326"));
                wfsProtocol.read({
                filter: new OpenLayers.Filter.Spatial({
                type: OpenLayers.Filter.Spatial.INTERSECTS,
                value: event.feature.geometry
                }),
                callback: function processSpatialQuery(response)
                {
               
                                                                                var feat = response.features;
                                                                                        var myArr = [];
                                                                                        for(var i=0; i<feat.length; ++i)
                                                                                        {  
                                                                                                myArr[i] = feat[i].clone();
                                                                                                      myArr[i].geometry.transform(projWGS84,projSphericalMercator);
                                                                                        }
                                                                                        if(selectFeaturevectorLayer.features.length)
                                                                                        {
                                                                                                selectFeaturevectorLayer.removeAllFeatures();
                                                                                        }
                                                                                        selectFeaturevectorLayer.addFeatures(myArr);
                                                                                       
                                                                                       
                                                                                         featureHighlightWindow.hide();
                }
               
                });
                }
            }
                        });
                       
                       
                        map.addControl(polygonSelectFeatureHighlightControl);
                        polygonSelectFeatureHighlightControl.activate();
                       
                       
Reply | Threaded
Open this post in threaded view
|

Re: How to form URL for to Export and download Selected features as KML formate

Phil Scadden

> I get selected features when i draw polygon using this
> polygonSelectFeatureHighlightControl control.
> But i want to export selected features as kml when i draw polygon.
>
> If i write code like this
> window.open(wfsProtocol.url+'?service=WFS&srs=EPSG:4326&version='+wfsProtocol.version+'&request=GetFeature&outputFormat=OGR-KML&typeName='+stateLayer.name);
>
> i get kml file for full layer,but i need kml file for selected features when
> i draw polygon.
>
> so please reply which param i want add in the window URL(how to form URL) to
> download kml file for selected features.

Did you get any response to this question? I am pretty interested
myself. One way would be convert the filter to a CQL inquiry. I have
done this pretty much to make protocol.script work. Its messy stuff but
works.
(CQL query has to be in native coordinates).


Notice: This email and any attachments are confidential. If received in error please destroy and immediately notify us. Do not copy or disclose the contents.

_______________________________________________
Dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/openlayers-dev
Reply | Threaded
Open this post in threaded view
|

Re: How to form URL for to Export and download Selected features as KML formate

mano3688
This same download option is not working in windows 7.

can you please guide me, how to use FWTools ogr2ogr export option in windows 7?

Thanks to all

Mano G