- From: Rushforth, Peter (NRCan/RNCan) <peter.rushforth@canada.ca>
- Date: Wed, 21 Feb 2018 15:20:28 +0000
- To: Rob Smith <rob.smith@awayteam.co.uk>
- CC: "public-maps4html@w3.org" <public-maps4html@w3.org>
Sorry there were a few revision typos in the code which likely makes it unreadable. Corrected below. <script> var circleLayer = document.implementation.createMAPMLDocument(); // (I saw something like this for HTML documents on MDN. Something similar could be useful for MapML) // creates a new MapML document, for which you can set the properties via DOM calls, e.g. title circleLayer.title = "New Circle Layer"; // var f = circleLayer.createElement('feature'); // libraries like Leaflet or OpenLayers could supply geometry constructors f.geometry = new Circle( Parameters for a 10-metre radius circle around the Greenwich Observatory at 51.48N, 0.00E go here). 'coordinate serialization method goes here'(); // or alternatively even maybe a factory method on the geometry element? The SimpleFeatures model doesn't forbid it I guess. Would have to ask the experts at OGC... f.geometry = f.geometry.circle( Parameters for a 10-metre radius circle around the Greenwich Observatory at 51.48N, 0.00E go here ); circleLayer.body.appendChild(f); //other manipulations for style, class etc // append the mapml document into the layer as content (no @src attribute required) document.querySelector('map.mymap').appendChild(document.createElement('layer').appendChild(circleLayer)); // circle appears on the map, and in the layer control </script> ... Thanks, Peter Peter Rushforth Technology Advisor Canada Centre for Mapping and Earth Observation / Earth Sciences Sector Natural Resources Canada / Government of Canada peter.rushforth@canada.ca / Tel: 613-759-7915 Conseiller technique Centre canadien de cartographie et d’observation de la Terre / Secteur des sciences de la Terre Ressources naturelles Canada / Gouvernement du Canada peter.rushforth@canada.ca / Tél: 613-759-7915
Received on Wednesday, 21 February 2018 15:20:56 UTC