generator/src/main/java/de/westnordost/countryboundaries/GeoJsonWriter.java
public String write(Geometry geometry)
	{
		try
		{
			JSONStringer b = new JSONStringer();
			if (geometry.getClass().equals(GeometryCollection.class))
			{
				writeFeatureCollection(b, (GeometryCollection) geometry);
			}
			else
			{
				writeFeature(b, geometry);
			}
			return b.toString();
		}
		catch (JSONException e)
		{
			throw new GeoJsonException(e);
		}
	}
public String write(Geometry geometry)
	{
		try
		{
			JSONStringer b = new JSONStringer();
			if (geometry.getClass().equals(GeometryCollection.class))
			{
				writeFeatureCollection(b, (GeometryCollection) geometry);
			}
			else
			{
				writeFeature(b, geometry);
			}
			return b.toString();
		}
		catch (JSONException e)
		{
			throw new GeoJsonException(e);
		}
	}
Writes a geometry to GeoJSON.
Note that any data stored in getUserData() of the geometries that is not on the top level
GeometryCollection, is lost in the process.