citygml4j / citygml-tools

Collection of tools for processing CityGML files
Apache License 2.0
115 stars 18 forks source link

Retrojecting and Conversion problem #21

Closed sevamoo closed 3 years ago

sevamoo commented 3 years ago

Thanks a lot for the great work. I am trying to convert GML to Cityjson and also change the CRS projection, but I think I am missing something.

1- Reprojection:

In the original gml I have the following info:

<gml:boundedBy>
    <gml:Envelope srsName="urn:ogc:def:crs:EPSG:2056, crs:EPSG:5728" srsDimension="3">
        <gml:lowerCorner>2599973.425 1196927.116 502.084144504226</gml:lowerCorner>
        <gml:upperCorner>2602012.431 1198012.063 686.930225642009</gml:upperCorner>
    </gml:Envelope>
</gml:boundedBy>

After running the following command, however, the height-related projection is gone: Command:

reproject --target-crs='EPSG:4326' --source-crs='EPSG:2056' ./Sample_swissBUILDINGS3D2.0_LV95\ 3/CityGML/Sample_swissBUILDINGS3D20_LV95_1166-42.gml

<gml:boundedBy>
    <gml:Envelope srsName="EPSG:4326" srsDimension="3">
        <gml:lowerCorner>46.92344162543317 7.43828343878568 502.084144504226</gml:lowerCorner>
        <gml:upperCorner>46.933198120404676 7.465058911575889 686.930225642009</gml:upperCorner
    </gml:Envelope>
</gml:boundedBy>

While I see the Lat/Lng is correct, but now when I test the GML file with Azul or Ninja.city, It doesn't visualize the buildings, even though there is no error. I think perhaps, I need to something with the height CRS.

Of course, my final goal is to convert the CityGML to CityJson using the target CRS, but I am yet at this stage.

I would really appreciate your help.

Best Vahid

clausnagel commented 3 years ago

Hi @sevamoo, sorry for not responding earlier.

You can use the option --target-name to force a specific value for the srsName attribute used in the output file. However, I doubt that the azul or ninja viewers actually parse and interpret the srsName attribute. So, changing the value of this attribute might not help. Not sure why your buildings are not visualized. Have you already tried the --target-force-xy option? Maybe this helps to solve the issue.

Can you provide a small test dataset so that I can try and better find the issue?

sevamoo commented 3 years ago

Hi @clausnagel Thanks for the reply. However, in the end, I decided not to convert the CRS here, but after the conversion, I do all sorts of conversions/manipulations in Python using cijo. Best Vahid