Given a Geobuf byte string on stdin, write a GeoJSON feature
    collection to stdout.
506186
def decode():
    """"""
    logger = logging.getLogger('geobuf')
    stdin = click.get_binary_stream('stdin')
    sink = click.get_text_stream('stdout')
    try:
        pbf = stdin.read()
        data = geobuf.decode(pbf)
        json.dump(data, sink)
        sys.exit(0)
    except Exception:
        logger.exception("Failed. Exception caught")
        sys.exit(1)
285945
function validateGeoJson(geoJson) {
  if (!geoJson)
    throw new Error('No geojson passed');

  if (geoJson.type !== 'FeatureCollection' &&
    geoJson.type !== 'GeometryCollection' &&
    geoJson.type !== 'MultiLineString' &&
    geoJson.type !== 'LineString' &&
    geoJson.type !== 'Feature'
  )
    throw new Error(`Invalid input type '${geoJson.type}'. Geojson must be FeatureCollection, GeometryCollection, LineString, MultiLineString or Feature`);
}
915654
def write(self, data):
        """"""
        cnpj, data = data

        path = os.path.join(self.output, '%s.json' % cnpj)
        with open(path, 'w') as f:
            json.dump(data, f, encoding='utf-8')
83450
def ips_to_geojson(ipaddresses):
    """"""

    features = []

    for ipaddress in ipaddresses:
        geo = gi.record_by_addr(ipaddress)

        features.append({
            "type": "Feature",
            "properties": {
                "name": ipaddress
            },
            "geometry": {
                "type": "Point",
                "coordinates": [
                    geo["longitude"],
                    geo["latitude"]
                ]
            }
        })

    points = {
        "type": "FeatureCollection",
        "features": features
    }

    return points
472678
def write_json(self, **kwargs):
        
        self.stdout.write(json.dumps(kwargs) + "\n")
        self.stdout.flush()
263876
private void write(LineString geom, JsonGenerator gen) throws IOException {
        gen.writeStringField("type", "LineString");
        gen.writeFieldName("coordinates");
        writeCoordinates(geom.getCoordinates(), gen);
    }
1205132
def read_geojson(cls, path_or_json_or_string):
        """"""
        assert path_or_json_or_string
        data = None
        if isinstance(path_or_json_or_string, (dict, list)):
            data = path_or_json_or_string
        try:
            data = json.loads(path_or_json_or_string)
        except ValueError:
            pass
        try:
            path = path_or_json_or_string
            if path.endswith('.gz') or path.endswith('.gzip'):
                import gzip
                contents = gzip.open(path, 'r').read().decode('utf-8')
            else:
                contents = open(path, 'r').read()
            data = json.loads(contents)
        except FileNotFoundError:
            pass
        # TODO web address
        assert data, 'MapData accepts a valid geoJSON object, geoJSON string, or path to a geoJSON file'
        return cls(cls._read_geojson_features(data))
1179511
private static void outputVerb(final ByteArrayOutputStream baos, final String str) {
        if (str.length() == 1) {
            baos.write(254);
            baos.write(str.toCharArray()[0]);
        } else {
            final byte[] bytes = str.getBytes(Charsets.UTF_8);
            baos.write(255);
            baos.write(str.length());
            baos.write(bytes, 0, bytes.length);
        }
    }
241805
def write(self, buf):
        """"""
        if not isinstance(buf, six.binary_type):
            raise TypeError('buf: must be a bytes instance')
        # Be careful not to write zero-length chunks as they indicate the end of a body.
        if len(buf) == 0:
            return
        if self._content_length and self._bytes_written > self._content_length:
            raise RuntimeError('wrote too many bytes ({} > {})'
                                    .format(self._bytes_written, self._content_length))
        self._bytes_written += len(buf)
        if self._chunked:
            buf = create_chunk(buf)
        self._protocol.writer.write(buf)
92114
public static void writeMapEntry(OutputAccessor out, String key, Object value) {

        out.write((byte) '\"');

        if (key == null)
            out.write(NULL);
        else {
            writeUtf8(out, key);
        }

        out.write(Q_AND_C);

        toJSONString(out, value);
    }
942459
def stream_stdin_lines():
    """"""
    stdin = os.fdopen(sys.stdin.fileno(), 'r', 0)
    while True:
        line = stdin.readline()
        if line:
            yield line
        else:
            break
74060
public void writeMapBegin(String type)
        throws IOException
    {
        os.write('M');
        os.write('t');
        printLenString(type);
    }
877216
def dispatch_write(self, buf):
        """"""
        self.write_buffer += buf
        if len(self.write_buffer) > self.MAX_BUFFER_SIZE:
            console_output('Buffer too big ({:d}) for {}\n'.format(
                len(self.write_buffer), str(self)).encode())
            raise asyncore.ExitNow(1)
        return True
1222061
public <T> void write(final OutputStream stream, final T object,
			final DataTypeDescriptor<T> descriptor, final boolean indent) throws IOException {
		if (stream == null) throw new NullPointerException("out");
		if (descriptor == null) throw new NullPointerException("descriptor");

		JsonGenerator generator = factory.createGenerator(stream);
		if (indent) {
			generator.useDefaultPrettyPrinter();
		}

		write(object, descriptor, generator);
		generator.flush();
	}
747503
public static String JsonFromFeature(EsriFeature feature) throws JsonGenerationException, JsonMappingException, IOException{
		return jsonObjectMapper.writeValueAsString(feature);
	}
981268
function ( ) {
				var Features = [];
				for ( var Counter = 0; Counter < _Pins.length; Counter++) {
					Features.push ( _Pins [ Counter ].toGeoJSON ( ) );
				}
				
				return {
					"type": "FeatureCollection",
					"features" : Features
				};
				
			}
419768
def make_geojson(contents):
    
    if isinstance(contents, six.string_types):
        return contents

    if hasattr(contents, '__geo_interface__'):
        features = [_geo_to_feature(contents)]
    else:
        try:
            feature_iter = iter(contents)
        except TypeError:
            raise ValueError('Unknown type for input')

        features = []
        for i, f in enumerate(feature_iter):
            if not hasattr(f, '__geo_interface__'):
                raise ValueError('Unknown type at index {0}'.format(i))
            features.append(_geo_to_feature(f))

    data = {'type': 'FeatureCollection', 'features': features}
    return json.dumps(data)