Riepilogo quello che succede usando un file chiamato pippo.kml (esportato da Google Earth) con OGR2Layers su Qgis:

OGR2Layers crea i files:
index.html
pippo.kml.gml
pippo.kml.xsd

Index.html apre una pagina completamente bianca.

il contenuto dei files รจ:

index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>OGR2Layers</title>
<style>
 #map{width:400px;height:400px;}
</style>
<script src="http://www.openlayers.org/api/2.8/OpenLayers.js";></script>
<script type="text/javascript">
var map, selectsControls
function init(){
    var option = {
        projection: new OpenLayers.Projection("EPSG:900913"),
        displayProjection: new OpenLayers.Projection("EPSG:4326")
    };
    map = new OpenLayers.Map('map', option);
olmapnik = new OpenLayers.Layer.OSM("OpenStreetMap Mapnik", "http://tile.openstreetmap.org/${z}/${x}/${y}.png";);
    map.addLayer(olmapnik);
    map.setBaseLayer(olmapnik);
var pippo.kml = new OpenLayers.Layer.GML("pippo.kml GML","pippo.kml.gml");
    map.addLayer(pippo.kml);
    var ls= new OpenLayers.Control.LayerSwitcher();
    map.addControl(ls);
    ls.maximizeControl();
extent = new OpenLayers.Bounds(11.651145,44.276291,11.68136,44.30021).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
    map.zoomToExtent(extent);
};
</script>
</head>
<body onload="init()">
<h1></h1>
<div id="map"></div>
</body>
</html>

pippo.kml.gml
<?xml version="1.0" encoding="utf-8" ?>
<ogr:FeatureCollection
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://ogr.maptools.org/ pippo.xsd"
     xmlns:ogr="http://ogr.maptools.org/";
     xmlns:gml="http://www.opengis.net/gml";>

</ogr:FeatureCollection>


pippo.kml.xsd

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://ogr.maptools.org/"; xmlns:ogr="http://ogr.maptools.org/"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:gml="http://www.opengis.net/gml"; elementFormDefault="qualified" version="1.0"> <xs:import namespace="http://www.opengis.net/gml"; schemaLocation="http://schemas.opengeospatial.net/gml/2.1.2/feature.xsd"/><xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/>
<xs:complexType name="FeatureCollectionType">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureCollectionType">
<xs:attribute name="lockId" type="xs:string" use="optional"/>
<xs:attribute name="scope" type="xs:string" use="optional"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="pippo.kml" type="ogr:pippo.kml_Type" substitutionGroup="gml:_Feature"/>
<xs:complexType name="pippo.kml_Type">
<xs:complexContent>
<xs:extension base="gml:AbstractFeatureType">
<xs:sequence>
<xs:element name="geometryProperty" type="gml:GeometryPropertyType" nillable="true" minOccurs="1" maxOccurs="1"/>
<xs:element name="Name" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="unbounded"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:element name="Description" nillable="true" minOccurs="0" maxOccurs="1">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:maxLength value="unbounded"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>


Ciao

Alberto
_______________________________________________
Talk-it mailing list
Talk-it@openstreetmap.org
http://lists.openstreetmap.org/listinfo/talk-it

Rispondere a