Read the GeoJSON feature collection from the request body and
            create new objects in the database.
196456
def create(self, request):
        
        if self.readonly:
            return HTTPMethodNotAllowed(headers={'Allow': 'GET, HEAD'})
        collection = loads(request.body, object_hook=GeoJSON.to_instance)
        if not isinstance(collection, FeatureCollection):
            return HTTPBadRequest()
        session = self.Session()
        objects = []
        for feature in collection.features:
            create = False
            obj = None
            if hasattr(feature, 'id') and feature.id is not None:
                obj = session.query(self.mapped_class).get(feature.id)
            if self.before_create is not None:
                self.before_create(request, feature, obj)
            if obj is None:
                obj = self.mapped_class(feature)
                create = True
            else:
                obj.__update__(feature)
            if create:
                session.add(obj)
            objects.append(obj)
        session.flush()
        collection = FeatureCollection(objects) if len(objects) > 0 else None
        request.response.status_int = 201
        return collection
836893
protected JSON createJSON( Map model, HttpServletRequest request, HttpServletResponse response ) {
      return defaultCreateJSON( model );
   }
693990
function db(objectName) {
    if (_.isBoolean(save.hasLoaded)) deasync.loopWhile(() => !save.hasLoaded);
    if (!_.has(objects, objectName)) objects[objectName] = {};
    return createMethods(objects[objectName], save.bind(null, objectName));
  }
1309589
function(features) {
        var collection, geometry, isCollection;
        if (features.constructor == Array) {
            collection = features;
            isCollection = true;
        } else {
            collection = [features];
            isCollection = false;
        }
        var pieces = [];
        if (isCollection) {
            pieces.push('GEOMETRYCOLLECTION(');
        }
        for (var i=0, len=collection.length; i<len; ++i) {
            if (isCollection && i>0) {
                pieces.push(',');
            }
            geometry = collection[i].geometry;
            pieces.push(this.extractGeometry(geometry));
        }
        if (isCollection) {
            pieces.push(')');
        }
        return pieces.join('');
    }
931687
@Override
    public Collection<String> createResources(Request request)
            throws InvalidQueryException, ResourceNotFoundException, ResourceAlreadyExistsException {

        Collection<String> relativeUrls = new ArrayList<>();
        AtlasQuery atlasQuery = queryFactory.createEntityQuery(request);
        Collection<String> guids = new ArrayList<>();
        for (Map<String, Object> entityMap: atlasQuery.execute()) {
            guids.add(String.valueOf(entityMap.get("id")));
        }

        Collection<Map<String, String>> tagMaps = request.getProperty("tags");
        for (Map<String, String> tagMap : tagMaps) {
            Result termResult = getTermQueryResult(tagMap.get("name"));
            relativeUrls.addAll(tagEntities(guids, termResult.getPropertyMaps().iterator().next()));
        }
        return relativeUrls;
    }
974074
function toGeoJSON(json, options = Options) {
  const collection = helpers.featureCollection([])
  json.resourceSets[0].resources.map(result => {
    // Point GeoJSON
    const point = parsePoint(result)
    const bbox = parseBBox(result)
    let confidence = confidenceScore(bbox)
    const properties = {
      confidence,
      authenticationResultCode: json.authenticationResultCode,
      brandLogoUri: json.brandLogoUri,
      copyright: json.copyright,
      entityType: result.entityType,
      matchCodes: result.matchCodes,
      name: result.name,
      statusCode: json.statusCode,
      statusDescription: json.statusDescription,
      traceId: json.traceId,
    }
    Object.keys(result.address).forEach(key => properties[key] = result.address[key])

    // Store Point to GeoJSON feature collection
    if (point) {
      point.bbox = bbox
      point.properties = properties
      collection.features.push(point)
    }
  })
  return collection
}
672691
def create_mongo_db(database_name, collection_name, initial_document):
    """"""
    response_dict = {}
    try:
        mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
                                 'mongodb://localhost:27017/')
        mc = MongoClient(mongodb_client_url,document_class=OrderedDict)

        db = mc[str(database_name)]
        collection = db[str(collection_name)]

        d = json.loads(initial_document, object_pairs_hook=OrderedDict)

        collection.save(d)

    except:
        # error connecting to mongodb
        response_dict['error'] = str(sys.exc_info())

    return response_dict
668478
def read_points(features):
    
    for feature in features:

        if isinstance(feature, (tuple, list)) and len(feature) == 2:
            yield feature

        elif hasattr(feature, '__geo_interface__'):
            # An object implementing the geo_interface
            try:
                # Could be a Feature...
                geom = feature.__geo_interface__['geometry']
                for pt in _geom_points(geom):
                    yield pt
            except KeyError:
                # ... or a geometry directly
                for pt in _geom_points(feature.__geo_interface__):
                    yield pt

        elif 'type' in feature and feature['type'] == 'Feature':
            # A GeoJSON-like mapping
            geom = feature['geometry']
            for pt in _geom_points(geom):
                yield pt

        elif 'coordinates' in feature:
            geom = feature
            for pt in _geom_points(geom):
                yield pt

        else:
            raise InvalidFeatureError(
                "Unknown object: Not a GeoJSON Point feature or "
                "an object with __geo_interface__:\n{0}".format(feature))
702727
function couchdb (json) {
  return {
    prepareEndpoint (endpointOptions, sourceOptions) {
      return prepareEndpoint(json, endpointOptions, sourceOptions)
    },

    async send (request) {
      return send(json, request)
    },

    async serialize (data, request) {
      const serializedData = await serializeData(data, request, json)
      return json.serialize(serializedData, request)
    },

    async normalize (data, request) {
      const normalizedData = await json.normalize(data, request)
      return normalizeData(normalizedData)
    }
  }
}
320023
def instantiate(self, params):
        
        try:
            self.send(self.Meta.collection_endpoint, "POST", json=params)
        except CartoRateLimitException as e:
            raise e
        except Exception as e:
            raise CartoException(e)
522227
public static Geometry geomFromGeoJSON(String geojson) throws IOException, SQLException {
        if (geojson == null) {
            return null;
        }
        if (jsFactory == null) {
            jsFactory = new JsonFactory();
            jsFactory.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
            jsFactory.configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
            jsFactory.configure(JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS, true);
            reader = new GJGeometryReader(new GeometryFactory());
        }
        JsonParser jp = jsFactory.createParser(geojson);
        return reader.parseGeometry(jp);
    }
1089746
def read(self, request, filter=None, id=None):
        
        ret = None
        if id is not None:
            o = self.Session().query(self.mapped_class).get(id)
            if o is None:
                return HTTPNotFound()
            # FIXME: we return a Feature here, not a mapped object, do
            # we really want that?
            ret = self._filter_attrs(o.__geo_interface__, request)
        else:
            objs = self._query(request, filter)
            ret = FeatureCollection(
                [self._filter_attrs(o.__geo_interface__, request)
                 for o in objs if o is not None])
        return ret
981268
function ( ) {
				var Features = [];
				for ( var Counter = 0; Counter < _Pins.length; Counter++) {
					Features.push ( _Pins [ Counter ].toGeoJSON ( ) );
				}
				
				return {
					"type": "FeatureCollection",
					"features" : Features
				};
				
			}
458371
def _create(self, **kwargs):
        """"""
        path = self._construct_path_to_collection()

        # Use the fields for which we have values
        for field in self.writable_fields:
            try:
                value = getattr(self, field)
                kwargs[field] = value
            except AttributeError:
                pass
        return self._http.post(path, json.dumps(kwargs))
860202
function(json){
    
    // Protect against forgetting the new keyword when calling the constructor
    if(!(this instanceof Collection)){
      return new Collection(json);
    }
    
    // If the given object is already an instance then just return it. DON'T copy it.
    if(Collection.isInstance(json)){
      return json;
    }
    
    this.init(json);
  }
1344831
def fromFeatureClass(fc, paramName):
        
        from ..common.spatial import featureclass_to_json
        val = json.loads(featureclass_to_json(fc))
        v = GPFeatureRecordSetLayer()
        v.value = val
        v.paramName = paramName
        return v
1305103
@Override
    public void newDoc() throws IOException {
        sb = new StringBuilder();
        baos = new ByteArrayOutputStream();
        generator = jsonFactory.createJsonGenerator(baos);
        generator.writeStartObject(); 
    }