CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
13.02k stars 3.51k forks source link

Use postgis one point within a polygon. but cesium, the point not in the polgyon #12308

Closed jiuxs33 closed 1 week ago

jiuxs33 commented 1 week ago

What happened?

SELECT st_within(
  ST_SetSRID(ST_MakePoint(-7.501, -7.304), 4326), 
  ST_SetSRID(
      ST_GeomFromText(
         'POLYGON((1.7692616 2.0455745, 18.6604818 -11.8586094, -23.141023 -53.3422643, -53.5110959 -46.4332639, 1.7692616 2.0455745))'
      ), 4326)
)
viewer.entities.add({
    position: Cesium.Cartesian3.fromDegrees(-7.501, -7.304),
    point: {
      pixelSize: 10,
      color: Cesium.Color.YELLOW,
    },
  });
  viewer.entities.add({
    polygon: {
      hierarchy: new Cesium.PolygonHierarchy(
        Cesium.Cartesian3.fromDegreesArray([
          1.7692616,2.0455745, 18.6604818,-11.8586094, -23.141023,-53.3422643, -53.5110959,-46.4332639, 1.7692616,2.0455745
        ]),
      ),
      height: 0,
      extrudedHeight: 0,
      outline: true,
      outlineColor: Cesium.Color.WHITE,
      outlineWidth: 4,
      material: Cesium.Color.fromRandom({ alpha: 1.0 }),
    },
  });

Reproduction steps

1. 2. 3. ...

Sandcastle example

No response

Environment

Browser: CesiumJS Version: Operating System:

ggetz commented 1 week ago

Hi @jiuxs33, there should be no need to repeat the first last to close the polygon when using PolygonHierarchy.

CesiumJS is a big project, so we use GitHub for feature requests and bug tracking exclusively. In the future, please take any questions to the Cesium Forum where there are members of the community and developers from the team who can help. Thanks!

jiuxs33 commented 5 days ago

I delete the last point, but this problem still exists. cesium

GatorScott commented 5 days ago

Change the polygon's arcType to RHUMB and you'll see the point inside the polygon.

jiuxs33 commented 4 days ago

thanks