kjordahl/geopandas — pull request #50 by jwass (2013-11-01 06:33:18+00:00)
Title: Add omitna option to GeoDataFrame.to_json

When omitna is true, any properties that are NaN will not be written out.
This means that different features can have different numbers of properties,
which is okay for GeoJSON. Writing out NaN values is not valid JSON and causes
problems for some parsers.

This introduces a new flag, `omitna`, to `GeoDataFrame.to_json()`. Each feature's properties are evaluated independently and null values are removed before serializing to JSON. I originally wanted to call this `dropna` but thought that could be confusing as `dropna` typically removes whole rows or columns, whereas `omitna` effectively removes single elements from the output.