# XML format for a file that only contains points?

**URL:** https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308
**Category:** ParaView Support
**Created:** [May 27, 2021, 11:56pm UTC](https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308 "2021-05-27T23:56:24Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![datathing](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/e8c25b/32.png) [@datathing](https://discourse.paraview.org/u/datathing)
#### Post date: [May 27, 2021, 11:56pm UTC](https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308/1 "2021-05-27T23:56:24Z")

</div>

This should be an incredibly simple question, but I can’t get this to work. What is wrong with the XML file below such that I can’t plot the the points as XYZ in ParaView?

```
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" byte_order="LittleEndian">
  <UnstructuredGrid>
    <Piece NumberOfPoints="8" NumberOfCells="0">
      <PointData>
      </PointData>
      <CellData>
      </CellData>
      <Points>
        <DataArray type="Float64" Name="Points" NumberOfComponents="3" format="ascii" RangeMin="0" RangeMax="1">
            0 0 0
			1 0 0
			1 1 0
			0 1 0
			0 0 1
			1 0 1
			1 1 1
			0 1 1
        </DataArray>
      </Points>
      <Cells>
      </Cells>
    </Piece>
  </UnstructuredGrid>
</VTKFile>

```

Thanks!

---

<div class="post-metadata">

### Author: ![jfavre](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/b5ac83/32.png) [@jfavre](https://discourse.paraview.org/u/jfavre)
#### Post date: [May 28, 2021, 6:28am UTC](https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308/2 "2021-05-28T06:28:10Z")

</div>

the bare minimum you would need for a correct definition of the Cells element is the following:

```
    <Cells>
    <DataArray Name="connectivity"></DataArray>
    <DataArray Name="offsets"></DataArray>
    <DataArray Name="types"></DataArray>
  </Cells>

```

However, without cell elements, quite a few filters will not be able to operate on your data. The default view representation “Points” will also not work. “Point Gaussian” will work.  
After reading your data, you may use a Glyph filter with “2D Glyph” and “Vertex” types to add cell elements.

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [May 28, 2021, 11:59am UTC](https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308/3 "2021-05-28T11:59:43Z")

</div>

As @jfavre mentioned, you’ll typically also need some ‘cells’.  
For the lightest format, you should be targeting a vtp output.  
Generating offsets and connectivity is dead easy.

Eg,

```auto
<?xml version="1.0"?>
<VTKFile type='PolyData' version='0.1' byte_order='LittleEndian' header_type='UInt64'>
  <PolyData>
    <Piece NumberOfPoints='8' NumberOfVerts='8'>
      <Points>
        <DataArray type="Float64" Name="Points" NumberOfComponents="3" format="ascii">
           ...
        </DataArray>
      </Points>
      <Verts>
        <DataArray Name="offsets">
1 2 3 4 5 6 7 8
        </DataArray>
        <DataArray Name="connectivity">
0 1 2 3 4 5 6 7
        </DataArray>
      </Verts>
    </Piece>
  </PolyData>
</VTKFile>

```

---

<div class="post-metadata">

### Author: ![datathing](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/d/e8c25b/32.png) [@datathing](https://discourse.paraview.org/u/datathing)
#### Post date: [May 28, 2021, 4:20pm UTC](https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308/4 "2021-05-28T16:20:46Z")

</div>

Thanks! Using the @jfavre and @olesenm’s advice I was able to get this to work. I have included the XML text below in case anyone else needs to do this. I needed to add ‘Type=’ to the ‘Vert’ data arrays and include a ‘PointData’ section to get the values associated with the point coordinates:

```
<?xml version="1.0"?>
<VTKFile type="PolyData" version="0.1" byte_order="LittleEndian" header_type="UInt64">
  <PolyData>
    <Piece NumberOfPoints="8" NumberOfVerts="8">
      <Points>
        <DataArray type="Float64" Name="Coordinate_of_points" NumberOfComponents="3" format="ascii">
            0 0 0
			1 0 0
			1 1 0
			0 1 0
			0 0 1
			1 0 1
			1 1 1
			0 1 1
        </DataArray>
      </Points>
	  <PointData>
		<DataArray type="Float64" Name="Value_at_point" NumberOfComponents="1" format="ascii">
            0.6
			1.1
			1.9
			0.1
			0.9
			1.2
			1.3
			0.3
        </DataArray>
	  </PointData>
      <Verts>
        <DataArray type="Int32" Name="offsets">
			1 2 3 4 5 6 7 8
        </DataArray>
        <DataArray type="Int32" Name="connectivity">
			0 1 2 3 4 5 6 7
        </DataArray>
      </Verts>
    </Piece>
  </PolyData>
</VTKFile>

```

I’ve marked this one as the solution since it has the working XML text, but credit to @jfavre and @olesenm!

---

<div class="post-metadata">

### Author: ![olesenm](https://discourse.paraview.org/user_avatar/discourse.paraview.org/olesenm/32/17416_2.png) [@olesenm](https://discourse.paraview.org/u/olesenm)
#### Post date: [May 28, 2021, 7:32pm UTC](https://discourse.paraview.org/t/xml-format-for-a-file-that-only-contains-points/7308/5 "2021-05-28T19:32:56Z")

</div>

@datathing  
FWIW, I generally lump all of my geometry together (Points, Verts, etc) and have the PointData and CellData after. Makes it easier to _stream_ data like that, if you have a writeGeometry() method and later various write field methods.

eg, [OpenFOAM vtk lagrangian writer](https://develop.openfoam.com/Development/openfoam/-/blob/master/src/lagrangian/intermediate/conversion/vtk/foamVtkLagrangianWriter.H#L193)
