Forum

Author Topic: Invalid shape - polygonal  (Read 8285 times)

Damian

  • Newbie
  • *
  • Posts: 42
    • View Profile
Invalid shape - polygonal
« on: February 25, 2021, 10:58:13 AM »
Hello

For every project I create a kml with several polygonal shapes. Each shape has a description - map section's number. With Metashape 1.6. it was not a problem to import it and use for exporting shapes with proper file name. Now with 1.7. when I import a kml (which by the way in QGIS is imported as polygon), I cannot use it for export - just as if it was a poyline, not polygon. I cannot use it as boundary or measure the area.

In attachement two examples of KML.

I do not want to downgrade to 1.6. Is there any way you could make it work?

Best wishes
Damian

vbarty

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Invalid shape - polygonal
« Reply #1 on: March 04, 2021, 01:35:22 AM »
Hi Damian,

I've tried to look into the issue and downloaded your kml files and imported them to Metashape. It seems that these two files have a different structure - one is imported as one layer with multiple objects and the second is imported as multiple layers (each containing one object) - but I was still able to import them and set boundary type on each polygon without any problems.

I'm not sure what you mean by using them for exporting shapes with the proper file name. Do you want to export each polygon as a separate file? Or you want to use each polygon as a boundary for your ortho/dem/point cloud export? 

Damian

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: Invalid shape - polygonal
« Reply #2 on: March 04, 2021, 11:52:35 AM »
Hi

They might have different structure, but the point is that in 1.6 Metashape I am able to set them as boundary, while in 1.7 Metashape this option is greyed out. What is more I cannot calculate the area which makes me think that they are being imported as polyline, not polygon.

I use them to export ortho and dem in parts, but now I cannot do it. KMLs are prepared and exported from QGIS.

What version of Metashape do you use? I downgraded to 1.6.6. and the problem dissapeared.  However, that is not the solution I expected to work out.

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15159
    • View Profile
Re: Invalid shape - polygonal
« Reply #3 on: March 14, 2021, 02:14:19 PM »
Hello Damian,

Which 1.7 version you are using?

Can you please check, if the issue is resolved in 1.7.2 pre-release:
http://download.agisoft.com/metashape-pro_1_7_2_x64.msi                   - Windows 64 bit
http://download.agisoft.com/metashape-pro_1_7_2.dmg                          - macOS
http://download.agisoft.com/metashape-pro_1_7_2_amd64.tar.gz           - Linux 64 bit
Best regards,
Alexey Pasumansky,
Agisoft LLC

Corensia

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
Re: Invalid shape - polygonal
« Reply #4 on: April 15, 2021, 11:26:09 AM »
Dear Alexey,

We're also seeing a similar situation with DXF files.

We would draw a polygon to measure the volume of a pile and then export the shape in DXF form to use for future measurements. When the shape is imported into Metashape again, it is considered as a polyline and cannot be used to measure the volume even though it is opened as a polygon in other programs. This bug was first seen in 1.7.1 and continues in 1.7.2. The last documented case of it working fine was in 1.6.4.

Hope that helps.

Warm regards,
David

Alexey Pasumansky

  • Agisoft Technical Support
  • Hero Member
  • *****
  • Posts: 15159
    • View Profile
Re: Invalid shape - polygonal
« Reply #5 on: April 15, 2021, 08:21:57 PM »
Hello David,

Thank you for reporting. We'll check it in the latest version and see, if it could be fixed quickly.
Best regards,
Alexey Pasumansky,
Agisoft LLC

Matt

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Invalid shape - polygonal
« Reply #6 on: February 09, 2022, 06:24:42 AM »
Hi Alexey,

I am still having trouble with importing a shape to set as the boundary for Orthomosaic clipping.

I have attached a kml that enables you to set the type as Boundary in version 1.5 but will not give that option in version 1.8

Can you advise a workaround other than loading the project in 1.5 to do it.

Many Thanks

Matt


Paulo

  • Hero Member
  • *****
  • Posts: 1359
    • View Profile
Re: Invalid shape - polygonal
« Reply #7 on: February 09, 2022, 08:50:24 AM »
Hello Matt,

your kml contains a MultiGeometry feature containing one polygon and so imports as a MultiPolygon type shape (instead of simple polygon) into Metashape 1.8. That is probably the reason you cannot set the boundary from context menu....see attachment. But if your feature is defined as a simple polygon in kml, then its boundary will be able to be set in Metashape...

A workaround dealing with multigeometry feature kml can be done by code snippet.... for example the following code would transform all MultiPolygon features present in a chunk to simple Polygons who can then be selected and boundary type set:
Code: [Select]
import Metashape as ps
chunk = ps.app.document.chunk
for s in [s for s in chunk.shapes if  s.geometry.type == ps.Geometry.Type.MultiPolygonType]: #transform all MultiPolygon into Polygons
    for i,g in enumerate(s.geometry.geometries):
        shape = chunk.shapes.addShape()
        shape.label = s.label + '_Polygon'  + str(i+1)
        shape.group = s.group
        shape.attributes = s.attributes
        shape.geometry = g
    chunk.shapes.remove([s])
« Last Edit: February 10, 2022, 07:25:39 PM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor

Matt

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Invalid shape - polygonal
« Reply #8 on: February 11, 2022, 01:54:54 AM »
Thanks Paulo,

That seems to have done the trick.
Weird that the shapes work with the old version though.
My thought is that Metashape is importing the shapes as multipolygon in error.


Paulo

  • Hero Member
  • *****
  • Posts: 1359
    • View Profile
Re: Invalid shape - polygonal
« Reply #9 on: February 11, 2022, 02:15:26 AM »
No problem, Matt,

since v. 1.8 and removal of class Shape.Type which had
Quote
Shape type (deprecated) in [Point, Polyline, Polygon]
and replacement with class Geometry.Type (from v.1.7) which has
Quote
Geometry type in [PointType, LineStringType, PolygonType, MultiPointType, MultiLineStringType, MultiPolygonType,
GeometryCollectionType]
, MultiGeometry feature types can now be recognized and so a MultiGeometry feature with one or more polygons will be imported as a MultiPolygon whereas previously (before 1.7) it was imported as one or more individual polygons...
« Last Edit: February 11, 2022, 02:20:30 AM by Paulo »
Best Regards,
Paul Pelletier,
Surveyor