[OpenLayers-Users] KML layer vector empty
Alexandre Dubé
adube at mapgears.com
Fri Oct 16 08:41:09 PDT 2015
Hello,
You should use StackOverflow for questions related to OpenLayers 3:
http://zeus.dev.where2getit.com/brooksbrothers/index_less_poi.html
Also, a JSFiddle would be a good way to attract people into helping you.
Regards,
Alexandre
On 15-10-16 11:29 AM, Jair Santos wrote:
> Hi all,
>
> I am creating vector layers in format KML. I have the sources in drop box to avoid CORS, but when I load them in the map they have no features. Any ideas about this issue will be very much appreciated.
>
> Thank you
>
> JJ.
>
> Please see below how I am doing it.
>
> var layers = [
>
> wms_bmid_pipes = new ol.layer.Vector({
> source: new ol.source.Vector({
> url: 'https://dl.dropboxusercontent.com/s/ea4qzzuyk5i2mxt /geid_ws-bmid-pipes.kml?dl=0',
> format: new ol.format.KML()
> })
> })
> ];
>
>
> Since the layer does not show up in the map I ran the code below to check how many features it has (this code comes from the open layers web site). It turns out that in the console I get "Count after change: 0" , meaning that there are no features.
>
> wms_bmid_pipes.getSource().on('change', function(evt){
> var source = evt.target;
> if (source.getState() === 'ready') {
> var numFeatures = source.getFeatures().length;
> console.log("Count after change: " + numFeatures);
> }
> });
>
>
> The point is that the wms_bmid_pipes contains this:
>
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <kml xmlns="http://www.opengis.net/kml/2.2" xmlns:ns2="http://www.google.com/kml/ext/2.2" xmlns:ns3="http://www.w3.org/2005/Atom" xmlns:ns4="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">
> <Document>
> <LookAt>
> <longitude>-119.3597596329119</longitude>
> <latitude>49.89850519575446</latitude>
> <altitude>19983.5008834143</altitude>
> <heading>0.0</heading>
> <tilt>0.0</tilt>
> <range>16147.716881798802</range>
> <altitudeMode>clampToGround</altitudeMode>
> </LookAt>
> <NetworkLink>
> <name>bmid-pipes</name>
> <visibility>1</visibility>
> <open>1</open>
> <LookAt>
> <longitude>-119.3597596329119</longitude>
> <latitude>49.89850519575446</latitude>
> <altitude>19983.5008834143</altitude>
> <heading>0.0</heading>
> <tilt>0.0</tilt>
> <range>16147.716881798802</range>
> <altitudeMode>clampToGround</altitudeMode>
> </LookAt>
> <Url>
> <href>http://localhost:8080/geoserver/geid_ws/wms?service=wms&request=GetMap&version=1.1.1&format=application/vnd.google-earth.kml+xml&layers=geid_ws:bmid-pipes&styles=line&height=2048&width=2048&transparent=false&srs=EPSG:4326&format_options=AUTOFIT:true;KMATTR:true;KMPLACEMARK:false;KMSCORE:40;MODE:refresh;SUPEROVERLAY:false</href>
> <refreshInterval>0.0</refreshInterval>
> <viewRefreshMode>onStop</viewRefreshMode>
> <viewRefreshTime>1.0</viewRefreshTime>
> <viewBoundScale>1.0</viewBoundScale>
> </Url>
> </NetworkLink>
> </Document>
> </kml>
>
> _______________________________________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
--
Alexandre Dubé
T: +1 418-696-5056 #203
http://www.mapgears.com/
More information about the Users
mailing list