Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create the 3D Line using pg2b3dm 2.13.0.0 #189

Closed
rahulkanani09 opened this issue Aug 8, 2024 · 8 comments
Closed

Unable to create the 3D Line using pg2b3dm 2.13.0.0 #189

rahulkanani09 opened this issue Aug 8, 2024 · 8 comments

Comments

@rahulkanani09
Copy link

rahulkanani09 commented Aug 8, 2024

Screenshot from 2024-08-08 10-00-10

When attempting to create a 3D line using pg2b3dm version 2.13.0.0, an error occurs, preventing the tile creation. The error message indicates a type casting issue between System.Int32 and System.Single.

Error details: Creating tile: 0_0_0.glb
Unhandled exception. System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.Single'.
at B3dm.Tileset.GeometryRepository.GetGeometries(NpgsqlConnection conn, String shaderColumn, String attributesColumns, String sql, String radiusColumn)
at B3dm.Tileset.GeometryRepository.GetGeometrySubset(NpgsqlConnection conn, String geometry_table, String geometry_column, Double[] bbox, Int32 source_epsg, Int32 target_srs, String shaderColumn, String attributesColumns, String query, String radiusColumn)

Environement Details:
Distributor ID: Ubuntu
Description: Ubuntu 20.04.1 LTS
Release: 20.04
Codename: focal

@bertt
Copy link
Member

bertt commented Aug 8, 2024

The radius column must be of type 'real', not of type int

@bertt
Copy link
Member

bertt commented Aug 8, 2024

See PR #190 , next release will also support int column type #190

@rahulkanani09
Copy link
Author

I tried with real datatype as well. It is giving me the following error:

Start generating tiles...
Creating tile: 0_0_0.glb Unhandled exception. System.InvalidOperationException: Nullable object must have a value.
at System.Nullable1.get_Value() at Triangulate.Triangulator.GetPoints(LineString lineString) at Triangulate.Triangulator.Triangulate(LineString lineString, Single radius, Nullable1 radialSegments, Boolean closed)
at Wkb2Gltf.GeometryProcessor.GetTrianglesFromLines(LineString line, Single radius, Double[] translation, Double[] scale, Nullable1 tabularSegments, Nullable1 radialSegments)
at Wkb2Gltf.GeometryProcessor.GetTriangles(Geometry geometry, Int32 batchId, Double[] translation, Double[] scale, ShaderColors shadercolors, Nullable1 radius) at Wkb2Gltf.GeometryRecord.GetTriangles(Double[] translation, Double[] scale) at pg2b3dm.TileWriter.GetTriangles(List1 geomrecords, Double[] translation, Double[] scale)
at pg2b3dm.TileWriter.ToTile(List1 geometries, Double[] translation, Double[] scale, String copyright, Boolean addOutlines, String defaultColor, String defaultMetallicRoughness, Boolean doubleSided, Boolean createGltf, Boolean YAxisUp) at pg2b3dm.QuadtreeTiler.GenerateTiles(BoundingBox bbox, Tile tile, List1 tiles, Int32 lod, Boolean addOutlines, String defaultColor, String defaultMetallicRoughness, Boolean doubleSided, Boolean createGltf)
at pg2b3dm.Program.<>c__DisplayClass2_0.

b__0(Options o)
at CommandLine.ParserResultExtensions.WithParsed[T](ParserResult1 result, Action1 action)
at pg2b3dm.Program.Main(String[] args)
Aborted (core dumped)

@bertt
Copy link
Member

bertt commented Aug 8, 2024

The vertices of the lines should have z values

@mittermichal
Copy link
Contributor

@rahulkanani09 using -nlt "LINESTRING Z" in ogr2ogr arguments adds Z to 2d lines

@bertt
Copy link
Member

bertt commented Aug 8, 2024

I'll probably make a PR that uses z=0 when there are no z values in the line

@rahulkanani09
Copy link
Author

@rahulkanani09 using -nlt "LINESTRING Z" in ogr2ogr arguments adds Z to 2d lines

ogr2ogr command : ogr2ogr -nlt "LINESTRING Z" -f "ESRI Shapefile" output.shp checked_fe_200_mp.shp.

It is working now. @bertt and @mittermichal Thanks for prompt support.

@bertt bertt closed this as completed Aug 8, 2024
@bertt
Copy link
Member

bertt commented Aug 8, 2024

note: both issues should no longer appear in 2.14

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants