njam / citygml-to-3dtiles

Convert from CityGML to Cesium 3D Tiles.
Apache License 2.0
160 stars 41 forks source link

How to use it ? SRS in gml #6

Closed JkGemma closed 5 years ago

JkGemma commented 5 years ago

Hello,

It would be cool to be able to use your tool, but I got a problem.

When I run :

node --max-old-space-size=10000 --experimental-modules ./bin/citygml-to-3dtiles.mjs path/to/file test

I get :

(node:26499) ExperimentalWarning: The ESM module loader is experimental.
Converting...
Reading CityGML file 1/1...
Found 1 city objects.

Unknown projection name: "EPSG:3943"

My SRS in the gml file is writen like that :

      <gml:Envelope srsName="EPSG:3943" srsDimension="3">

Is it wrong? If yes, I'd like to know how it should be write

Thanks to you! Jk.

JkGemma commented 5 years ago

Nevermind, added the ESPG and it's fine.

njam commented 5 years ago

Yes, unfortunately the list of available SRS is currently hardcoded in SRSTranslator.mjs. It would be nice if the http://epsg.io/ databases would be automatically queried for simple SRS..

For now I've added a link to the corresponding readme section to the error message.

yaryaraldebaran commented 2 years ago

Nevermind, added the ESPG and it's fine.

where do you put the ESPG?

njam commented 2 years ago

@yaryaraldebaran you can pass the SRS if you use the library programmatically in your own script like this: https://github.com/njam/citygml-to-3dtiles#option-srsprojections

Alternatively you could download the code, adjust SRSTranslator.mjs locally, and then run the local version.

yaryaraldebaran commented 2 years ago

thank you for your response, btw how do you get get the SRSname from citygml files? i want to add functionality that user can include the prj file as the SRS. for instance, i modified from your example

var SRSname = SRSname_from_gml ;
var SRSPRJ = SRS_from_PRJ;
let converter = new Converter({
  srsProjections: {
    '${SRSname}': '${SRSPRJ}',
  }
});
await converter.convertFiles('./input.xml', './output/');

i've read your code here but still haven't figured it out to recode it into my own code

njam commented 2 years ago

how do you get get the SRSname from citygml files?

The code currently takes the "srsName" attribute of the root element:

      srs = this.selectNode('//@srsName').value

This is a simplification though, see https://en.wiki.quality.sig3d.org/index.php/Modeling_Guide_for_3D_Objects_-_Part_1:_Basics_(Rules_for_Validating_GML_Geometries_in_CityGML)#Spatial_Reference_Systems_.28SRS.29