njam/citygml-to-3dtiles

How to use it ? SRS in gml

Closed this issue · 6 comments

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.

Nevermind, added the ESPG and it's fine.

njam commented

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.

Nevermind, added the ESPG and it's fine.

where do you put the ESPG?

njam commented

@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.

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

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