0

我有一个 OpenLayers 地图(您可以在此处找到,使用蓝色搜索区域)读取从 Perl 使用来自 oracle 的数据写入的 KML 字符串。它像这样读取 KML:

var vector_Layer = new OpenLayers.Layer.Vector("Search Results");

function GetFeaturesFromKMLString (strKML) {
    var format = new OpenLayers.Format.KML({
    'internalProjection': new OpenLayers.Projection("EPSG:900913"),
    'extranalProjection': new OpenLayers.Projection("EPSG:4326")    
    });
    return format.read(strKML);
};

vector_Layer.addFeatures(GetFeaturesFromKMLString('$newkml'));

我发现的问题是并非所有功能都显示出来。例如,如果我搜索 Edinburgh,则仅显示具有 11 个要素的 KML 中的前三个要素。在您搜索爱丁堡的地方生成的 KML 如下所示:

<?xml version="1.0" encoding="utf-8" ?><kml xmlns="http://www.opengis.net/kml/2.2"><Document><Folder><name>scotland_one_inch_1st</name><Schema name="scotland_one_inch_1st" id="scotland_one_inch_1st"><SimpleField name="Name" type="string"></SimpleField><SimpleField name="Description" type="string"></SimpleField><SimpleField name="SHEET" type="string"></SimpleField></Schema><Placemark><name>COLLINS, Greenvile</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">The east coast of Scotland with the isles of Orkney and Shetland</SimpleData></SchemaData><Data name="ID"><value>5728</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.7676,60.8791 .1049,60.8791 .1049,55.4382 -4.7676,55.4382</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>VAN KEULEN, Johannes</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Nieuwe pascaert van de oost cust van Schotlandt beginnende van Barwyck tot aen de Orcades ylanden</SimpleData></SchemaData><Data name="ID"><value>5972</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.1645,58.6564 -.7398,58.6564 -.7398,55.7407 -4.1645,55.7407</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>WAGHENAER, Lucas, Janszoon</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Beschrijuinge van een deel vann Schottlandt van Bambourg tot Aberdein daer Edenberg de princepaele coepstat?</SimpleData></SchemaData><Data name="ID"><value>5847</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.2504,57.1679 -1.3825,57.1679 -1.3825,55.5345 -3.2504,55.5345</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>KNOX, James</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Map of the Basin of the Firth of Forth, including the Lothians, Fife, & Kinross, with parts of the adjoining Shires</SimpleData></SchemaData><Data name="ID"><value>5464</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.0011,56.3508 -2.3221,56.3508 -2.3221,55.5773 -4.0011,55.5773</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>BLAEU, Joan</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Fifae Vicecomitatus, The Sherifdome of Fyfe</SimpleData></SchemaData><Data name="ID"><value>6172</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.6467,56.5955 -2.4311,56.5955 -2.4311,55.9404 -3.6467,55.9404</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>MOLL, Herman</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">The Shires of Fife and Kinros by H. Moll Geographer</SimpleData></SchemaData><Data name="ID"><value>5829</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.7619,56.4995 -2.364,56.4995 -2.364,55.9376 -3.7619,55.9376</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>BLAEU, Joan and Cornelis</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Lothian and Linlitquo</SimpleData></SchemaData><Data name="ID"><value>5824</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.737,56.143 -2.405,56.143 -2.405,55.7104 -3.737,55.7104</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>COLLINS, Greenvile</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Edinburgh Firth</SimpleData></SchemaData><Data name="ID"><value>5974</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.4581,56.3983 -2.4148,56.3983 -2.4148,55.8581 -3.4581,55.8581</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>THOMSON, John</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Northern part of Edinburgh Shire [2 separate sh.]</SimpleData></SchemaData><Data name="ID"><value>5501</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.7407,55.9899 -2.8252,55.9899 -2.8252,55.6441 -3.7407,55.6441</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>ADAIR, John</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">A map of Mid-Lothian, survey%27d by Mr J. Adair F.R.S.</SimpleData></SchemaData><Data name="ID"><value>5469</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.7407,55.9899 -2.8252,55.9899 -2.8252,55.6441 -3.7407,55.6441</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name></name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">Firth of Forth - Fisherrow to Edgar</SimpleData></SchemaData><Data name="ID"><value>156</value></Data></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.4441,56.0993 -3.0092,56.0993 -3.0092,55.9221 -3.4441,55.9221</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark></Folder></Document></kml>

以前有没有人遇到过这样的问题,您知道这是 KML 问题还是 OpenLayers 问题?

4