Multipatch creation error

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Multipatch creation error

Oscar Gomez Mateu
Hi,

I am new to ShapeLib. I am ussing the .net wrapper available at the project webpage. I have extended the wrapper to include the SHPRewindObject() of version 1.2.10. My objective is to create a simple multipatch building representation. Having a 2D building shape with an elevation property, create a real 3D block (with min 6 faces) imitating the building extrusion. I am able to do this with many polygonZ, but then every building is composed of N different polygons. I want the whole building to be a unique multipatch feature.

I am having problems with the Multipatch creation. As an example, I create a Multipatch composed of 2 triangles in a TriangleFan (a horizontal square -4points-) and a Ring (a vertical square sharing on of the triangles lines -5 points-).

            NVERTICES = 9;
            double[] bX = new double[NVERTICES] { 0,  10, 10,  0,  0,  0,  0,  0,  0 };
            double[] bY = new double[NVERTICES] { 0, 0, 10, 10, 0, 10, 10, 0, 0 };
            double[] bZ = new double[NVERTICES] { 10, 10, 10, 10, 10, 10, 0, 0, 10 };
            double[] bM = new double[NVERTICES] { 5, 5, 5, 5, 5, 5, 5, 5, 5 };
            ShapeLib.ShapeType shpType3 = ShapeLib.ShapeType.MultiPatch;

            int[] apartStart2 = new int[2] { 0, 4};
            ShapeLib.PartType[] apartType2 = new ShapeLib.PartType[2] { ShapeLib.PartType.TriangleFan, ShapeLib.PartType.Ring};

            pshpObj = ShapeLib.SHPCreateObject(shpType3, -1, 2, apartStart2, apartType2, NVERTICES, bX, bY, bZ, bM);

            int j = ShapeLib.SHPRewindObject(hShp, pshpObj);
            iRet = ShapeLib.SHPWriteObject(hShp, -1, pshpObj);
            ShapeLib.SHPDestroyObject(pshpObj);

The resulting file (the dbf is filled in a different part of the sample application) is interpreted right by GlobalMapper (a simple GIS package) but it is not rendered (even when the load launched no errors) by ArcScene.

Any idea why is this?

Thanks a lot
Oscar

PD: This time as subscribed member



_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multipatch creation error

Frank Warmerdam-2
Oscar Gomez Mateu wrote:

> Hi,
>
> I am new to ShapeLib. I am ussing the .net wrapper available at the
> project webpage. I have extended the wrapper to include the
> SHPRewindObject() of version 1.2.10. My objective is to create a simple
> multipatch building representation. Having a 2D building shape with an
> elevation property, create a real 3D block (with min 6 faces) imitating
> the building extrusion. I am able to do this with many polygonZ, but
> then every building is composed of N different polygons. I want the
> whole building to be a unique multipatch feature.
>
> I am having problems with the Multipatch creation. As an example, I
> create a Multipatch composed of 2 triangles in a TriangleFan (a
> horizontal square -4points-) and a Ring (a vertical square sharing on of
> the triangles lines -5 points-).
>
>             NVERTICES = 9;
>             double[] bX = new double[NVERTICES] { 0,  10, 10,  0,  0,  
> 0,  0,  0,  0 };
>             double[] bY = new double[NVERTICES] { 0, 0, 10, 10, 0, 10,
> 10, 0, 0 };
>             double[] bZ = new double[NVERTICES] { 10, 10, 10, 10, 10,
> 10, 0, 0, 10 };
>             double[] bM = new double[NVERTICES] { 5, 5, 5, 5, 5, 5, 5,
> 5, 5 };
>             ShapeLib.ShapeType shpType3 = ShapeLib.ShapeType.MultiPatch;
>
>             int[] apartStart2 = new int[2] { 0, 4};
>             ShapeLib.PartType[] apartType2 = new ShapeLib.PartType[2] {
> ShapeLib.PartType.TriangleFan, ShapeLib.PartType.Ring};
>
>             pshpObj = ShapeLib.SHPCreateObject(shpType3, -1, 2,
> apartStart2, apartType2, NVERTICES, bX, bY, bZ, bM);
>
>             int j = ShapeLib.SHPRewindObject(hShp, pshpObj);
>             iRet = ShapeLib.SHPWriteObject(hShp, -1, pshpObj);
>             ShapeLib.SHPDestroyObject(pshpObj);
>
> The resulting file (the dbf is filled in a different part of the sample
> application) is interpreted right by GlobalMapper (a simple GIS package)
> but it is not rendered (even when the load launched no errors) by ArcScene.
>
> Any idea why is this?

Oscar,

Can you provide access to the generated file and/or show the shpdump
result from this process?

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multipatch creation error

Oscar Gomez Mateu
Hi,

I attach all the shape related files.

How can I get the ShapeDump?

Thanks
Oscar

2010/9/14 Frank Warmerdam <[hidden email]>
Oscar Gomez Mateu wrote:
> Hi,
>
> I am new to ShapeLib. I am ussing the .net wrapper available at the
> project webpage. I have extended the wrapper to include the
> SHPRewindObject() of version 1.2.10. My objective is to create a simple
> multipatch building representation. Having a 2D building shape with an
> elevation property, create a real 3D block (with min 6 faces) imitating
> the building extrusion. I am able to do this with many polygonZ, but
> then every building is composed of N different polygons. I want the
> whole building to be a unique multipatch feature.
>
> I am having problems with the Multipatch creation. As an example, I
> create a Multipatch composed of 2 triangles in a TriangleFan (a
> horizontal square -4points-) and a Ring (a vertical square sharing on of
> the triangles lines -5 points-).
>
>             NVERTICES = 9;
>             double[] bX = new double[NVERTICES] { 0,  10, 10,  0,  0,
> 0,  0,  0,  0 };
>             double[] bY = new double[NVERTICES] { 0, 0, 10, 10, 0, 10,
> 10, 0, 0 };
>             double[] bZ = new double[NVERTICES] { 10, 10, 10, 10, 10,
> 10, 0, 0, 10 };
>             double[] bM = new double[NVERTICES] { 5, 5, 5, 5, 5, 5, 5,
> 5, 5 };
>             ShapeLib.ShapeType shpType3 = ShapeLib.ShapeType.MultiPatch;
>
>             int[] apartStart2 = new int[2] { 0, 4};
>             ShapeLib.PartType[] apartType2 = new ShapeLib.PartType[2] {
> ShapeLib.PartType.TriangleFan, ShapeLib.PartType.Ring};
>
>             pshpObj = ShapeLib.SHPCreateObject(shpType3, -1, 2,
> apartStart2, apartType2, NVERTICES, bX, bY, bZ, bM);
>
>             int j = ShapeLib.SHPRewindObject(hShp, pshpObj);
>             iRet = ShapeLib.SHPWriteObject(hShp, -1, pshpObj);
>             ShapeLib.SHPDestroyObject(pshpObj);
>
> The resulting file (the dbf is filled in a different part of the sample
> application) is interpreted right by GlobalMapper (a simple GIS package)
> but it is not rendered (even when the load launched no errors) by ArcScene.
>
> Any idea why is this?

Oscar,

Can you provide access to the generated file and/or show the shpdump
result from this process?

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib


_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib

testmultipatch.dbf (328 bytes) Download Attachment
testmultipatch.sbn (180 bytes) Download Attachment
testmultipatch.sbx (160 bytes) Download Attachment
testmultipatch.shp (550 bytes) Download Attachment
testmultipatch.shx (146 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multipatch creation error

Frank Warmerdam-2
In reply to this post by Frank Warmerdam-2

> Oscar Gomez Mateu wrote:
>> I am having problems with the Multipatch creation. As an example, I
>> create a Multipatch composed of 2 triangles in a TriangleFan (a
>> horizontal square -4points-) and a Ring (a vertical square sharing on of
>> the triangles lines -5 points-).


Oscar,

The shpdump for your file, created with the shpdump utility distributed
as part of shapelib looks like this:

warmerda@gdal64[109]% shpdump testmultipatch.shp
Shapefile Type: PolygonZ   # of Shapes: 1

File Bounds: (       0.000,       0.000,0,5)
          to  (      10.000,      10.000,10,5)

Shape:0 (MultiPatch)  nVertices=9, nParts=2
   Bounds:(       0.000,       0.000, 0)
       to (      10.000,      10.000, 10)
      (       0.000,       0.000, 10) TriangleFan
      (      10.000,       0.000, 10)
      (      10.000,      10.000, 10)
      (       0.000,      10.000, 10)
    + (       0.000,       0.000, 10) Ring
      (       0.000,      10.000, 10)
      (       0.000,      10.000, 0)
      (       0.000,       0.000, 0)
      (       0.000,       0.000, 10)

I have not done a complete analysis but it looks roughly plausible.

I can't comment on why this would not display properly in ArcScene.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multipatch creation error

Oscar Gomez Mateu
Hi,

coming back on the Multipatch creation problem.

I created an application that takes 2D polygon shapes (attached 'simpleshape2.shp') and creates a 3D polygon shape imitating an extrusion. Every original polygon turns into a bottom polygon (at 0 height), top polygon (at RELELEV attribute height) and as many verticall walls as vertex has the original polygon. An example can be seen in the attached 'simpleshape2_extr.shp'. In ArcGIS I merge all the polygons with the same ID into a multipatch with the tool 'Layer 3D to Feature Class' and I get the attached 'simpleshape2_extr_merge.shp'.

I then modified my application to create a multipatch shape as similar as possible to the merged example. The result is the attached 'simpleshape2M_extr.shp'.

Doing a shapedump of the 2 end result shapes it is possible to see that they are (beside the M values) identical. But 'simpleshape2_extr_merge.shp' gets rendered in ArcScene and the features are considered 'MultipatchM' and 'simpleshape2M_extr.shp' is not rendered and the features are considered PolygonZM.

Any idea what could be wrong?

Thanks
Oscar

2010/9/14 Frank Warmerdam <[hidden email]>

> Oscar Gomez Mateu wrote:
>> I am having problems with the Multipatch creation. As an example, I
>> create a Multipatch composed of 2 triangles in a TriangleFan (a
>> horizontal square -4points-) and a Ring (a vertical square sharing on of
>> the triangles lines -5 points-).


Oscar,

The shpdump for your file, created with the shpdump utility distributed
as part of shapelib looks like this:

warmerda@gdal64[109]% shpdump testmultipatch.shp
Shapefile Type: PolygonZ   # of Shapes: 1

File Bounds: (       0.000,       0.000,0,5)
         to  (      10.000,      10.000,10,5)

Shape:0 (MultiPatch)  nVertices=9, nParts=2
  Bounds:(       0.000,       0.000, 0)
      to (      10.000,      10.000, 10)
     (       0.000,       0.000, 10) TriangleFan
     (      10.000,       0.000, 10)
     (      10.000,      10.000, 10)
     (       0.000,      10.000, 10)
   + (       0.000,       0.000, 10) Ring
     (       0.000,      10.000, 10)
     (       0.000,      10.000, 0)
     (       0.000,       0.000, 0)
     (       0.000,       0.000, 10)

I have not done a complete analysis but it looks roughly plausible.

I can't comment on why this would not display properly in ArcScene.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib


_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib

SampleData.zip (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Multipatch creation error

Oscar Gomez Mateu
Hi again,

some extended information in the multipatch problem. The rendering problems (and interpretation of the multipatches as PolygonZM features) do only occur if there is a polygon with an inner hole (which is the case of the polygon 0 in the previously attached files).

I hope this helps
Oscar

2010/9/16 Oscar Gomez Mateu <[hidden email]>
Hi,

coming back on the Multipatch creation problem.

I created an application that takes 2D polygon shapes (attached 'simpleshape2.shp') and creates a 3D polygon shape imitating an extrusion. Every original polygon turns into a bottom polygon (at 0 height), top polygon (at RELELEV attribute height) and as many verticall walls as vertex has the original polygon. An example can be seen in the attached 'simpleshape2_extr.shp'. In ArcGIS I merge all the polygons with the same ID into a multipatch with the tool 'Layer 3D to Feature Class' and I get the attached 'simpleshape2_extr_merge.shp'.

I then modified my application to create a multipatch shape as similar as possible to the merged example. The result is the attached 'simpleshape2M_extr.shp'.

Doing a shapedump of the 2 end result shapes it is possible to see that they are (beside the M values) identical. But 'simpleshape2_extr_merge.shp' gets rendered in ArcScene and the features are considered 'MultipatchM' and 'simpleshape2M_extr.shp' is not rendered and the features are considered PolygonZM.

Any idea what could be wrong?

Thanks
Oscar

2010/9/14 Frank Warmerdam <[hidden email]>


> Oscar Gomez Mateu wrote:
>> I am having problems with the Multipatch creation. As an example, I
>> create a Multipatch composed of 2 triangles in a TriangleFan (a
>> horizontal square -4points-) and a Ring (a vertical square sharing on of
>> the triangles lines -5 points-).


Oscar,

The shpdump for your file, created with the shpdump utility distributed
as part of shapelib looks like this:

warmerda@gdal64[109]% shpdump testmultipatch.shp
Shapefile Type: PolygonZ   # of Shapes: 1

File Bounds: (       0.000,       0.000,0,5)
         to  (      10.000,      10.000,10,5)

Shape:0 (MultiPatch)  nVertices=9, nParts=2
  Bounds:(       0.000,       0.000, 0)
      to (      10.000,      10.000, 10)
     (       0.000,       0.000, 10) TriangleFan
     (      10.000,       0.000, 10)
     (      10.000,      10.000, 10)
     (       0.000,      10.000, 10)
   + (       0.000,       0.000, 10) Ring
     (       0.000,      10.000, 10)
     (       0.000,      10.000, 0)
     (       0.000,       0.000, 0)
     (       0.000,       0.000, 10)

I have not done a complete analysis but it looks roughly plausible.

I can't comment on why this would not display properly in ArcScene.

Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, [hidden email]
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib



_______________________________________________
Shapelib mailing list
[hidden email]
http://lists.maptools.org/mailman/listinfo/shapelib
Loading...