Re: Circle Support For MapML

Peter,

Thanks for your reply.

1. I understand your code, and agree that that is a correct solution in Javascript. However, I thought your aim was to achieve this result using MapML. Are you suggesting that Javascript embedded in a <script> element is a MapML solution?

2. I agree with the browser developer that extending the <map> element is not a good idea. It happens to be called ‘map’, but was never designed as a container for modern slippy maps. Repurposing it at this late stage in its lifetime will be confusing to existing users and will hamper your development with legacy issues, e.g. the shape types. Creating a new element, e.g. <geomap>, is much clearer to users and allows your design to evolve naturally, rather than to be shoehorned in.

Rob

Away Team
www.awayteam.co.uk <http://www.awayteam.co.uk/>
> On 21 Feb 2018, at 15:20, Rushforth, Peter (NRCan/RNCan) <peter.rushforth@canada.ca> wrote:
> 
> 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
> 

> On 20 Feb 2018, at 20:09, Rushforth, Peter (NRCan/RNCan) <peter.rushforth@canada.ca> wrote:
> 
> Hi Rob,
> 
> My turn to apologize for being slow to respond.
> 
> 
>> I’m not sure I understand what you’re proposing. Please can you give an example?
> 
> In Leaflet, for example, there are a couple of methods to create a circle.  Each of these creates a leaflet "Layer" object, which can be added to a map with the Layer.addTo(map) method.
> 
> If we think about how that could be done with map/layer support in HTML, I think the DOM is the natural API to target for extension.
> 
> Perhaps something like the following: 
> ...
> <!-- a map centred on Greenwich Observatory: -->
> <map class="mymap" zoom="15" lat="51.48" lon="0.0" width="640" height="480">
>  <layer src="base map  mapml url"/>
> </map
> 
> <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 );
> 
> circle.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(lyr));  
> 
> // circle appears on the map, and in the layer control
> </script>
> ...
> Hopefully this exercise in imagination helps??  People receiving this email are welcome to chime in...
> 
> 
>> As you’ve already added new ‘shape’ types, e.g. marker, perhaps you could also add new types which are identical to the geometry values, e.g. linestring, polygon, etc., some of which may be simple synonyms for pre-existing values, e.g. polygon and poly. The old values are still supported, and MapML users can choose whichever terminology they're more comfortable with.
> 
> I currently think the proposal to extend the @shape keyword list is a mistake.  I would prefer to not (ask browser developers to) tinker with code that has been running for 20 years unnecessarily.  I think the new semantics should mostly go into <layer> and related APIs as sketched above.  I mean I've already heard from a browser developer who said they are unlikely to extend <map> at all, and if they add geographic maps they would prefer to add a different element.  So in that case why bother talking about the area element at all.
> 
> For reasons best discussed in another (bikeshedding-but-not-really) thread, I think progressive enhancement (fallback / graceful degradation) is really important and the confusion of having a new element instead of extending and existing one of appropriate base semantics are important factors also.  
> For example, if the platform wanted to add sorting and selection functionality to the <table> element, would a new "<stable>" element be more or less confusing (to users not to mention maintainers of browsers) than extending the existing <table> element with new attributes?.
> 
> Cheers,
> Peter
> 
> 
> Peter Rushforth
> 
> Technology Advisor
> Canada Centre for Mapping and Earth Observation / Earth Sciences Sector
> Natural Resources Canada / Government of Canada
> mailto: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
> mailto:peter.rushforth@canada.ca / Tél: 613-759-7915

Received on Thursday, 22 February 2018 11:12:38 UTC