Question

Split CityGML dataset by location

  • 22 November 2017
  • 2 replies
  • 5 views

Hi,

I have a very large CityGML dataset consisting of millions of features. I would like to split this into smaller datasets so that each dataset contains at most a few hundred features, grouped by location (eg, possibly turning each city block into a separate CityGML file). The goal is to turn each CityGML dataset into a Cesium 3D Tileset :

CityGML -> [CityGML] -> [B3DM]

Any help would be appreciated. Thanks!


2 replies

Badge +8

Hi @gunea, in my search for a solution to reading a large CityGML file I noticed your question. In general, the approach I used below is not a solution, since reading GML is very complex and should not commence like this. However, this is what I did:

1. Create a worker workspace

2. Create a caller workspace.

The worker workspace uses a plain textfile reader to read the gml file and uses the Textfile reader parameters for Start Feature and Max Features to Read. After that it uses an XMLTemplater to create a valid XML from the block of lines read. Somehow, the XMLTemplater decodes textlines read into XML encoding which has to be undone (use TextDecoder). After that an XMLFragmenter to recreate individual features and do something useful with them (like storing them into a spatially indexed dataset). I had to add an XMLFormatter before the XMLFragmenter, since the source gml was unix terminated and without it the fragmenter picked up only the first feature. The results can be written using a dataset fanout per chunk.

The caller workspace just calls the worker using a WorkspaceRunner. For parameters there are:

  • The dataset name,
  • The start feature (which has value [_creation_instance] * chunksize),
  • The number of features to process (chunksize), and
  • The chunk number (for identifying datasets created)

No need to say that the GML should be containing one and only one feature per text file line. Should you still be interested, I could provide you with the two workspaces if you like.

Badge +16

Hi @gunea,

Have a look at the Tiler transformer, that can help produce distinct values for each tile (_column and _row) that you can use to write separate files.

See also: https://knowledge.safe.com/questions/19565/tiler-convert-a-huge-polygon-to-individual-tiles-1.html

Hope this helps.

Reply