Permalink
Browse files

don't write extra commas at end of properties list for GeoJSON/csv to…

… account for ignored dimensions
  • Loading branch information...
hobu committed Nov 26, 2012
1 parent 32d0998 commit cc0e0ed8dc285db6f0fb3a30870700c5d8ffbf03
Showing with 24 additions and 13 deletions.
  1. +8 −10 src/drivers/text/Writer.cpp
  2. +16 −3 test/data/pipeline/pipeline_geojson.xml
@@ -549,23 +549,22 @@ void Writer::WriteCSVBuffer(const PointBuffer& data)
{
std::vector<boost::tuple<std::string, std::string> >::const_iterator iter = dimensions.begin();
- bool bWroteProperty(false);
+ bool bFirstProperty(true);
while (iter != dimensions.end())
{
- if (bWroteProperty)
+ if (!bFirstProperty)
*m_stream << delimiter;
Dimension const& d = schema.getDimension(iter->get<0>(), iter->get<1>());
if (d.isIgnored())
{
iter++;
- bWroteProperty = false;
continue;
}
*m_stream << getStringRepresentation(data, d, pointIndex);
- bWroteProperty = true;
+ bFirstProperty = false;
iter++;
}
@@ -669,27 +668,26 @@ void Writer::WriteGeoJSONBuffer(const PointBuffer& data)
std::vector<boost::tuple<std::string, std::string> > dimensions = getDimensionOrder(schema);
std::vector<boost::tuple<std::string, std::string> >::const_iterator iter = dimensions.begin();
- bool bWroteProperty(false);
+ bool bFirstProperty(true);
while (iter != dimensions.end())
{
- if (bWroteProperty)
- *m_stream << ",";
-
Dimension const& d = schema.getDimension(iter->get<0>(), iter->get<1>());
if (d.isIgnored())
{
iter++;
- bWroteProperty = false;
continue;
}
+ if (!bFirstProperty)
+ *m_stream << ",";
+
*m_stream << "\"" << iter->get<0>() << "\":";
*m_stream << "\"" << getStringRepresentation(data, d, pointIndex) <<"\"";
iter++;
- bWroteProperty = true;
+ bFirstProperty = false;
}
@@ -19,19 +19,32 @@
<Option name="jscallback">
pointcloud_callback
</Option>
- <!-- <Filter type="filters.selector">
+ <Filter type="filters.selector">
<Option name="create">
<Options>
<Option name="dimension">Red<Options><Option name="type">uint16_t</Option><Option name="description">Colorization dimension</Option><Option name="endianness">big</Option><Option name="size">2</Option></Options></Option>
<Option name="dimension">Blue<Options><Option name="type">uint16_t</Option><Option name="description">Colorization dimension</Option><Option name="endianness">big</Option><Option name="size">2</Option></Options></Option>
<Option name="dimension">Green<Options><Option name="type">uint16_t</Option><Option name="description">Colorization dimension</Option><Option name="endianness">big</Option><Option name="size">2</Option></Options></Option>
</Options>
- </Option> -->
+ </Option>
+ <Option name="keep">
+ <Options>
+ <Option name="dimension">X</Option>
+ <Option name="dimension">Y</Option>
+ <Option name="dimension">Z</Option>
+ <Option name="dimension">Red</Option>
+ <Option name="dimension">Green</Option>
+ <Option name="dimension">Blue</Option>
+ <Option name="dimension">Intensity</Option>
+ <Option name="dimension">PointSourceId</Option>
+ <Option name="dimension">Classification</Option>
+ </Options>
+ </Option>
<Reader type="drivers.las.reader">
<Option name="filename">
../autzen-point-format-3.las
</Option>
</Reader>
- <!-- </Filter> -->
+ </Filter>
</Writer>
</Pipeline>

0 comments on commit cc0e0ed

Please sign in to comment.