Maps4HTML / Web-Map-Custom-Element

A custom <mapml-viewer> and <layer-> element suite
https://maps4html.org/Web-Map-Custom-Element/
Other
54 stars 15 forks source link

Error in calculating extent of layer with no specified projection #899

Open prushforth opened 9 months ago

prushforth commented 9 months ago

The extent of layers with no specified projection fails to take into account the projecton of the map viewer, resulting in incorrect extent/bounds calculations.

In the screen shot below, the extent/bounds are the tiny dot in tile col=2,row=3, and the place mark is supposed to be within that extent.

image

Steps to recreate

Use this map:

<mapml-viewer projection="CBMTILE" controls lat="0" lon="0" zoom="0" >
    <layer- src="test.mapml" checked></layer->
</mapml-viewer>

where test.mapml is the following:

<mapml- xmlns="http://www.w3.org/1999/xhtml">
  <map-head>
    <map-title>Extent bug</map-title>
    <map-meta charset="utf-8" ></map-meta>

    <map-meta name="extent" content="top-left-latitude=45.5, top-left-longitude=-75.8, bottom-right-latitude=45.3, bottom-right-longitude=-75.6"></map-meta> 
  </map-head>
  <map-body>
    <map-feature id="thing1">
      <map-featurecaption>a11y caption goes here</map-featurecaption>
        <map-geometry cs="gcrs">
          <map-point>
            <map-coordinates>-75.691084 45.4079051</map-coordinates>
          </map-point>
        </map-geometry>
        <map-properties>
          <h1>Feature properties html</h1>
        </map-properties>
    </map-feature>
  </map-body>
</mapml->

Here's a \ that has a geometry that matches the <map-meta name="extent" ...> above:

    <map-feature id="thing2">
      <map-featurecaption>extent as a feature</map-featurecaption>
        <map-geometry cs="gcrs">
          <map-polygon>
            <map-coordinates> -75.8 45.5 -75.6 45.5 -75.6 45.3 -75.8 45.3 -75.8 45.5</map-coordinates>
          </map-polygon>
        </map-geometry>
        <map-properties>
          <h1>Feature properties html</h1>
        </map-properties>
    </map-feature>
AliyanH commented 9 months ago

Implemented in https://github.com/Maps4HTML/Web-Map-Custom-Element/pull/854

prushforth commented 9 months ago

Implemented in #854

I think the bug is present in our map-extent branch though, so probably still a bug?

yhy0217 commented 9 months ago

Relates to #677

prushforth commented 4 months ago

The symptoms of this problem are now different, but there's still a problem. If you zoom to the \ above, you won't zoom into the small polygon that does surround the point, but to a much larger extent that doesn't seem related to the layer content:

image