I'm using OpenLayers 4 to build a web map. Now I'm trying to add a GML layer to the map but only one feature of the layer/GML is painted in the map. So I don't know what could be wrong.
The way I am doing this is:
function addGML (layer) {
//the function receives a GML file that is imported in the app
var vector = new ol.layer.Vector({
source: new ol.source.Vector({
url: layer.url,
format: new ol.format.GML({
srsName: 'EPSG:23030'
})
}),
name: layer.name,
type: 'GML'
});
vector.set('name', layer.name);
this.map_.addLayer(vector);
return vector;
}
The GML file is this:
100526.0003 3987304.0001
621651.8125 4288889.0001
0
05
05
0526
0
0
0
052600000001
0
0
0
GUADALQUIVIR DESDE EL TRANCO AL GUADIANA
MENOR
9728.46341771
0
0
517055.4077 4226197.9999 517169.4065 4226127.0009 517264.0937 4226050.9997 517329.8121 4226008.9993 517516.3142 4225897.9997 517634.9067 4225840.9999 517694.3121 4225781.9999 517794.9057 4225712.9999 517925.3131 4225600.0003 518031.4999 4225461.0005 518001.9995 4225351.0005 517635.5938 4225332.0001 517525.5937 4225301.9999 517375.4067 4225227.9985 517271.6877 4225165.0001 517168.0937 4225050.0007 517129.9999 4224967.9999 517071.0933 4224811.9997 516925.3127 4224590.0005 516823.8127 4224498.9997 516696.9063 4224397.0001 516576.1879 4224261.0005 516532.0003 4224167.9999 516489.8125 4224100.0001 516465.8121 4224027.9997 516388.0935 4223856.9999
516229.906 4223735.9999 516139.3127 4223671.9999 516045.4999 4223831.0005 516025.3129 4223913.9997 515994.4997 4224011.9997 515972.9997 4224181.0005 515869.0945 4224299.9997 515824.5003 4224361.9997 515654.9997 4224402.0003 515585.4997 4224459.0001 515525.5937 4224571.9997 515459.9061 4224633.0003 515324.3121 4224704.0003 515285.5937 4225095.9999 515233.6871 4225206.9995 515180.3121 4225269.9999 515040.8127 4225388.0007 515007.4999 4225565.0001 514969.3129 4225634.9997 514757.4063 4225705.0003 514690.5933 4225772.9991 514632.1865 4225870.9999 514591.6873 4225973.9999 514704.0937 4225947.0001 515046.0003 4225986.9997 515246.1871 4225968.0003 515422.8127 4226048.0003 515480.594 4226114.9997 515521.0932 4226188.0007 515643.9067 4226212.9995 515758.3121 4226162.9997 515961.4061 4226308.9995 516050.3127 4226349.0001 516172.1873 4226373.9999 516304.3129 4226425.0003 516465.1875 4226429.0001 516597.906 4226395.9997 516746.3123 4226327.0005 516880.4061 4226315.0001 517055.4077 4226197.9999
2
05
05
0503
050302
05030202
0
0
0
0
0
GUADALIMAR
36071.8591842
0
0
456461.5941 4224654.9999 456588.5937 4224610.9997 456934.5941 4224644.9995 457013.8127 4224654.0005 457129.6865 4224633.0003 457364.5943 4224514.0003 457505.4065 4224446.9999 457599.4999 4224409.9997 457692.5005 4224343.9999 457923.8129 4224197.0005 458187.8123 4224126.9999 458344.3123 4224020.0001 458426.4997 4223918.9999 458477.1877 4223861.9999 458658.8125 4223629.9995 458812.6879 4223511.9999 458914.3127 4223462.9995 458977.8121 4223422.0005 459053.6873 4223333.9999 459120.8126 4223173.9999 459149.9997 4223076.0001 459183.1875 4222925.0001 459231.4067 4222818.0003 459335.6877 4222669.0001 459465.5933 4222560.9999 459668.5943 4222439.9989 459957.4063 4222242.0003 460135.8127 4222018.9997 460306.5943 4221897.9997 460377.0937 4221837.0001 460203.5943 4221650.0003 460063.8121 4221561.9997 459848.0943 4221395.0007 459601.3123 4221253.9999 459533.1877 4221216.0003 459447.188 4221179.0001 459333.5937 4221102.9999 459235.3121 4221029.0005 459152.1879 4220967.9999 458903.6877 4220820.9995 458849.8131 4220718.9999 458808.4055 4220644.0001 458735.1875 4220505.9997 458669.9997 4220409.9997 458488.8121 4220238.9999 458395.4069 4220162.0003 458290.8125 4220084.9995 458201.3128 4220009.0003 458084.3127 4219934.9999 457960.0001 4219867.9997 457798.8121 4219744.9998 457668.0935 4219629.0001 457547.4059 4219469.0001 457343.3125 4219241.9997 457127.5935 4219090.9997 456991.4999 4219029.9999 456880.9999 4218983.9999 456753.4065 4218930.0003 456641.5939 4218880.0003 456423.8127 4218743.9999 456340.5 4218656.0003 456289.3123 4218599.0005 456063.3125 4218377.0003 455993.8125 4218317.0001 455811.8129 4218132.0011 455739.3127 4218053.9999 455671.3129 4218018.0003 455567.6872 4217961.0003 455406.8127 4217851.0001 455016.4065 4217728.9998 454921.4059 4217685.9999 454808.0943 4217641.0003 454685.0003 4217625.0003 454549.5005 4217677.0001 454448.5003 4217748.0001 454371.0941 4217707.0001 454312.0001 4217634.9997 454198.4067 4217433.9997 454047.4067 4217213.0001 453964.8129 4217147.9997 453709.0935 4216973.0001 453454.4051 4216832.0003 453300.9997 4216811.9997 453165.3125 4216816.0003 452937.0947 4216850.9997 452835.5937 4216862.9999 452354.0937 4216942.0005 452169.9067 4216957.0001 452091.1877 4216957.0001 451962.9061 4216958.0005 451890.3127 4217044.9995 451753.1879 4217285.9999 451686.6883 4217392.9998 451646.5945 4217481.0003 451618.4059 4217600.9998 451551.3125 4217837.0011 451518.5003 4217913.0003 451459.9061 4217975.9999 451334.8121 4218050.0003 451223.1879 4218102.9995 451091.3121 4218141.0001 450891.5943 4218189.0001 450738.3127 4218258.9997 450591.0001 4218301.0001 450449.0941 4218324.9985 450338.6875 4218267.0001 450181.6889 4218240.0003 450040.8121 4218212.9995 449944.5939 4218199.0005 449701.1881 4218242.0003 449615.8121 4218244.0001 449530.3123 4218247.0005 449378.6875 4218315.0001 449320.0932 4218384.0003 449271.0937 4218446.9999 449180.3121 4218535.0005 449101.6873 4218603.9997 448998.9064 4218713.0003 448959.0933 4218798.9999 449029.6879 4218841.0003 449120.0937 4218930.0003 449193.9057 4219054.9999 449217.5939 4219161.9997 449300.5953 4219305.0003 449452.4995 4219618.0003 449597.9065 4219765.9999 449730.3127 4219883.9997 449812.0935 4219941.9999 449917.4999 4220000.0003 450105.4059 4220075.9997 450190.8137 4220094.9999 450276.4068 4220117.9999 450362.4997 4220158.0005 450453.5937 4220199.9999 450601.0937 4220327.9999 450762.3123 4220466.0003 450848.5003 4220510.0005 450995.0941 4220583.9999 451226.5938 4220660.9995 451483.0003 4220717.0001 451630.6877 4220740.0001 451745.4065 4220743.9999 452035.9061 4220765.0001 452214.0933 4220759.9999 452332.3121 4220741.0005 452448.9999 4220683.0001 452590.6877 4220580.0001 452639.5941 4220514.0003 452761.5001 4220261.9999 452829.9065 4220171.9997 452907.8123 4220112.9998 452978.9067 4220002.9997 453014.6863 4219931.0001 453118.4061 4219778.9997 453197.9997 4219671.9999 453229.5941 4219593.9997 453237.5937 4219456.9998 453225.3128 4219380.0001 453236.5 4219257.9997 453352.9063 4219248.0003 453570.0937 4219271.0005 453825.3123 4219287.9999 453916.4995 4219285.9999 454041.5001 4219277.0001 454128.3129 4219269.9999 454363.9066 4219269.0005 454447.4057 4219234.9997 454514.3127 4219188.0001 454637.3125 4219120.9987 454799.0001 4219022.0005 454916.3127 4219205.9999 455003.3127 4219417.0003 455048.0001 4219593.0003 455106.9999 4219901.9995 455132.4063 4220144.9998 455139.1873 4220238.9999 455139.5937 4220324.0001 455163.5943 4220463.0009 455191.6877 4220553.9997 455192.6871 4220752.9998 455231.9995 4220987.0001 455270.8121 4221101.0001 455313.9063 4221232.9998 455369.8125 4221396.9995 455426.0937 4221611.0001 455566.9991 4221796.9995 455620.5 4221893.0015 455659.4069 4222034.9997 455685.5005 4222160.0003 455694.4061 4222245.0005 455711.8121 4222325.9999 455734.1875 4222423.9999 455749.9059 4222531.0007 455796.5943 4222743.9999 455835.6875 4222932.9995 455792.5935 4223090.0003 455730.6875 4223152.9999 455654.8121 4223243.0001 455587.1873 4223303.0005 455481.8125 4223440.0003 455448.6861 4223602.0003 455435.9066 4223815.0005 455458.8125 4223920.9999 455497.3128 4223995.0001 455544.3123 4224061.0001 455783.0937 4224293.0005 455844.9065 4224361.0003 455898.3123 4224425.9997 455881.9999 4224565.0005 455691.5001 4224644.9995 455644.3131 4224765.0001 455580.6879 4224845.0001 455484.906 4224905.9997 455336.9063 4225010.9997 455197.3125 4225081.9997 455087.3125 4225161.9997 455020.9992 4225222.9995 454982.0943 4225328.9999 455067.0935 4225353.0003 455151.9063 4225353.0003 455389.0003 4225248.9999 455573.1881 4225182.0015 455810.4059 4225092.9995 455884.4063 4225045.9999 456053.8127 4224980.9995 456135.5935 4224939.0001 456299.0003 4224814.9999 456364.5005 4224765.9995 456461.5941 4224654.9999
Any idea what could be the problem?
Answer
You should simply replace your ol.format.GML
with ol.format.WFS
. I've made a quick prototype based on your sample data where you get all the features when you do this change.
No comments:
Post a Comment