1

我正在尝试将 kml 显示为矢量图层。我将它存储为 Perl 标量变量,但也尝试将其设置为 javascript 变量。我试图将我从这里的问题中得到的代码分开。第一个不会产生错误,但 vector_layer 不显示http://www.geos.ed.ac.uk/~s0825955/cgi-bin/maps4.pl

var kml_string = '<?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>John Thomson, Linlithgowshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Linlithgowshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.8271,56.0204 -3.3023,56.0204 -3.3023,55.8149 -3.8271,55.8149</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Stirlingshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Stirlingshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.6992,56.2988 -3.6282,56.2988 -3.6282,55.8927 -4.6992,55.8927</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Berwick-Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Berwick-Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-2.9047,55.944 -2.0344,55.944 -2.0344,55.5665 -2.9047,55.5665</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Peebles-Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Peebles-Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.5401,55.8247 -2.9182,55.8247 -2.9182,55.403 -3.5401,55.403</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Kirkcudbright-Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Kirkcudbright-Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.6636,55.3226 -3.563,55.3226 -3.563,54.7662 -4.6636,54.7662</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Edinburgh Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Edinburgh Shire....</SimpleData></SchemaData></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>John Thomson, Northern Part of Lanarkshire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Lanarkshire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.3831,55.9402 -3.394,55.9402 -3.394,55.2893 -4.3831,55.2893</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Haddington....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Haddington....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.0132,56.0792 -2.364,56.0792 -2.364,55.8175 -3.0132,55.8175</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Orkney Islands....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Orkney Islands....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.4344,59.3921 -2.3736,59.3921 -2.3736,58.6868 -3.4344,58.6868</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Roxburghshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Roxburghshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.1198,55.7047 -2.1658,55.7047 -2.1658,55.1084 -3.1198,55.1084</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Kincardine Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Kincardine Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-2.7564,57.1307 -2.0535,57.1307 -2.0535,56.7444 -2.7564,56.7444</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Caithness Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Caithness Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.8585,58.6938 -3.024,58.6938 -3.024,58.1369 -3.8585,58.1369</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Western Isles....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Western Isles....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-7.698,58.5156 -6.1365,58.5156 -6.1365,56.7781 -7.698,56.7781</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Dumbartonshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Dumbartonshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.8813,56.3316 -3.8628,56.3316 -3.8628,55.8899 -4.8813,55.8899</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Buteshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Buteshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.3982,55.9269 -4.899,55.9269 -4.899,55.424 -5.3982,55.424</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Sutherland Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Sutherland Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.4047,58.6275 -3.5972,58.6275 -3.5972,57.8487 -5.4047,57.8487</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Argyll Shire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Argyll Shire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-7.1189,56.8668 -4.5622,56.8668 -4.5622,55.2767 -7.1189,55.2767</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Selkirk Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Selkirk Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.3554,55.6913 -2.763,55.6913 -2.763,55.3408 -3.3554,55.3408</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Skye Island, &amp;#38;c....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Skye Island, &amp;#38;c....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-6.7898,57.7461 -5.648,57.7461 -5.648,56.8242 -6.7898,56.8242</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Angus Shire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Angus Shire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.4065,56.9857 -2.3875,56.9857 -2.3875,56.4327 -3.4065,56.4327</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Ross and Cromarty Shires. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Ross and Cromarty Shires. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.8722,58.1262 -3.7721,58.1262 -3.7721,57.0951 -5.8722,57.0951</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Aberdeen &amp;#38; Banff Shires. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Aberdeen &amp;#38; Banff Shires. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.8016,57.7065 -1.7667,57.7065 -1.7667,56.8723 -3.8016,56.8723</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Perthshire with Clackmannan....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Perthshire with Clackmannan....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.8529,56.9484 -3.0572,56.9484 -3.0572,56.0796 -4.8529,56.0796</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, County of Wigtown or Shire of Galloway...</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, County of Wigtown or Shire of Galloway...</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.1864,55.0613 -4.3442,55.0613 -4.3442,54.6336 -5.1864,54.6336</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Renfrew Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Renfrew Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.8985,55.9624 -4.226,55.9624 -4.226,55.6724 -4.8985,55.6724</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Fife with Kinross Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Fife with Kinross Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.7405,56.453 -2.5472,56.453 -2.5472,56.0059 -3.7405,56.0059</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Ayrshire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Ayrshire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.1242,55.8898 -3.9608,55.8898 -3.9608,54.9976 -5.1242,54.9976</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Dumfriesshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Dumfriesshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.1218,55.4606 -2.857,55.4606 -2.857,54.9645 -4.1218,54.9645</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Shetland Islands....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Shetland Islands....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-2.1162,60.8545 -.7347,60.8545 -.7347,59.5132 -2.1162,59.5132</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Nairn and Elgin....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Nairn and Elgin....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.0087,57.7248 -2.9907,57.7248 -2.9907,57.2932 -4.0087,57.2932</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Inverness Shire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Inverness Shire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-6.0806,57.6319 -3.4317,57.6319 -3.4317,56.6859 -6.0806,56.6859</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark></Folder></Document></kml>'; // you kml text stored as a javascript string
var kmlParser = new OpenLayers.Format.KML({extractAttributes: true});
var featurelist = kmlParser.read(kml_string);

var vector_Layer = new OpenLayers.Layer.Vector(featurelist);

这是第二次尝试。它Uncaught SyntaxError: Unexpected identifier在我尝试添加控件时产生select = new OpenLayers.Control.SelectFeature(vector_Layer);http://www.geos.ed.ac.uk/~s0825955/cgi-bin/maps3.pl

var vector_Layer = new OpenLayers.Layer.Vector();

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

vector_Layer.addFeatures(GetFeaturesFromKMLString('<?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>John Thomson, Linlithgowshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Linlithgowshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.8271,56.0204 -3.3023,56.0204 -3.3023,55.8149 -3.8271,55.8149</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Stirlingshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Stirlingshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.6992,56.2988 -3.6282,56.2988 -3.6282,55.8927 -4.6992,55.8927</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Berwick-Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Berwick-Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-2.9047,55.944 -2.0344,55.944 -2.0344,55.5665 -2.9047,55.5665</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Peebles-Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Peebles-Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.5401,55.8247 -2.9182,55.8247 -2.9182,55.403 -3.5401,55.403</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Kirkcudbright-Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Kirkcudbright-Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.6636,55.3226 -3.563,55.3226 -3.563,54.7662 -4.6636,54.7662</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Edinburgh Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Edinburgh Shire....</SimpleData></SchemaData></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>John Thomson, Northern Part of Lanarkshire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Lanarkshire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.3831,55.9402 -3.394,55.9402 -3.394,55.2893 -4.3831,55.2893</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Haddington....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Haddington....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.0132,56.0792 -2.364,56.0792 -2.364,55.8175 -3.0132,55.8175</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Orkney Islands....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Orkney Islands....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.4344,59.3921 -2.3736,59.3921 -2.3736,58.6868 -3.4344,58.6868</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Roxburghshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Roxburghshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.1198,55.7047 -2.1658,55.7047 -2.1658,55.1084 -3.1198,55.1084</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Kincardine Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Kincardine Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-2.7564,57.1307 -2.0535,57.1307 -2.0535,56.7444 -2.7564,56.7444</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Caithness Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Caithness Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.8585,58.6938 -3.024,58.6938 -3.024,58.1369 -3.8585,58.1369</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Western Isles....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Western Isles....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-7.698,58.5156 -6.1365,58.5156 -6.1365,56.7781 -7.698,56.7781</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Dumbartonshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Dumbartonshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.8813,56.3316 -3.8628,56.3316 -3.8628,55.8899 -4.8813,55.8899</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Buteshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Buteshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.3982,55.9269 -4.899,55.9269 -4.899,55.424 -5.3982,55.424</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Sutherland Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Sutherland Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.4047,58.6275 -3.5972,58.6275 -3.5972,57.8487 -5.4047,57.8487</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Argyll Shire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Argyll Shire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-7.1189,56.8668 -4.5622,56.8668 -4.5622,55.2767 -7.1189,55.2767</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Selkirk Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Selkirk Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.3554,55.6913 -2.763,55.6913 -2.763,55.3408 -3.3554,55.3408</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Skye Island, &amp;#38;c....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Skye Island, &amp;#38;c....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-6.7898,57.7461 -5.648,57.7461 -5.648,56.8242 -6.7898,56.8242</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Angus Shire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Angus Shire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.4065,56.9857 -2.3875,56.9857 -2.3875,56.4327 -3.4065,56.4327</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Ross and Cromarty Shires. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Ross and Cromarty Shires. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.8722,58.1262 -3.7721,58.1262 -3.7721,57.0951 -5.8722,57.0951</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Aberdeen &amp;#38; Banff Shires. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Aberdeen &amp;#38; Banff Shires. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.8016,57.7065 -1.7667,57.7065 -1.7667,56.8723 -3.8016,56.8723</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Perthshire with Clackmannan....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Perthshire with Clackmannan....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.8529,56.9484 -3.0572,56.9484 -3.0572,56.0796 -4.8529,56.0796</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, County of Wigtown or Shire of Galloway...</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, County of Wigtown or Shire of Galloway...</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.1864,55.0613 -4.3442,55.0613 -4.3442,54.6336 -5.1864,54.6336</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Renfrew Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Renfrew Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.8985,55.9624 -4.226,55.9624 -4.226,55.6724 -4.8985,55.6724</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Fife with Kinross Shire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Fife with Kinross Shire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-3.7405,56.453 -2.5472,56.453 -2.5472,56.0059 -3.7405,56.0059</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Ayrshire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Ayrshire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-5.1242,55.8898 -3.9608,55.8898 -3.9608,54.9976 -5.1242,54.9976</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Dumfriesshire....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Dumfriesshire....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.1218,55.4606 -2.857,55.4606 -2.857,54.9645 -4.1218,54.9645</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Shetland Islands....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Shetland Islands....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-2.1162,60.8545 -.7347,60.8545 -.7347,59.5132 -2.1162,59.5132</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Nairn and Elgin....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Nairn and Elgin....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-4.0087,57.7248 -2.9907,57.7248 -2.9907,57.2932 -4.0087,57.2932</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark><Placemark><name>John Thomson, Northern Part of Inverness Shire. Southern Part....</name><ExtendedData><SchemaData schemaUrl="scotland_one_inch_1st"><SimpleData name="SHEET">John Thomson, Northern Part of Inverness Shire. Southern Part....</SimpleData></SchemaData></ExtendedData><Polygon><outerBoundaryIs><LinearRing><coordinates>-6.0806,57.6319 -3.4317,57.6319 -3.4317,56.6859 -6.0806,56.6859</coordinates></LinearRing></outerBoundaryIs></Polygon></Placemark></Folder></Document></kml>'))

我以为它最后应该有一个分号,但它吐了出来。

所以我想问的是你会推荐我坚持使用哪种技术,我需要解决什么问题?

编辑:添加了缺少的括号后,第二个答案现在会产生相同的无错误但空白的响应

4

1 回答 1

1

我认为你在这里缺少一个右括号

vector_Layer.addFeatures(GetFeaturesFromKMLString(
于 2013-07-06T19:51:44.590 回答