Submit a getfeature request to DataBC WFS and return features
964312
def make_request(parameters):
    
    r = requests.get(bcdata.WFS_URL, params=parameters)
    return r.json()["features"]
1240319
function getClientById(snapshot, clientId, apiId, done) {
  logger.debug('getClientById entry');

  // build request to send to data-store
  var queryfilter = { where: { and: [] } };
  queryfilter.where.and[0] = { 'snapshot-id': snapshot };
  queryfilter.where.and[1] = { 'api-id': apiId };
  queryfilter.where.and[2] = { 'client-id': clientId };

  var queryurlObj = {
    protocol: 'http',
    hostname: host,
    port: process.env.DATASTORE_PORT,
    pathname: '/api/optimizedData',
    query: { filter: JSON.stringify(queryfilter) } };
  var queryurl = url.format(queryurlObj);

  const cached = cache[queryurl];
  if (cached && useCache) {
    done(undefined, cached);
  } else {
    request({ url: queryurl, json: true }, function(error, response, body) {
      if (error) {
        logger.debug('error: ', error);
        return done(error);
      }

      var optimizedData = body;
      if (!optimizedData || optimizedData.length === 0) {
        return done('no matched client');
      }
      cache[queryurl] = optimizedData;
      done(undefined, optimizedData);
    });
  }
}
571288
def request_get_variable_json(self, py_db, request, thread_id):
        '''
        
        '''
        py_db.post_method_as_internal_command(
            thread_id, internal_get_variable_json, request)
858083
function runGetFeature(callback) {
  var next = _.after(2, callback);
  function featureCallback(error, feature) {
    if (error) {
      callback(error);
      return;
    }
    if (feature.name === '') {
      console.log('Found no feature at ' +
          feature.location.latitude/COORD_FACTOR + ', ' +
          feature.location.longitude/COORD_FACTOR);
    } else {
      console.log('Found feature called "' + feature.name + '" at ' +
          feature.location.latitude/COORD_FACTOR + ', ' +
          feature.location.longitude/COORD_FACTOR);
    }
    next();
  }
  var point1 = {
    latitude: 409146138,
    longitude: -746188906
  };
  var point2 = {
    latitude: 0,
    longitude: 0
  };
  client.getFeature(point1, featureCallback);
  client.getFeature(point2, featureCallback);
}
510279
def execute(self, input_data):
        """"""
        if 'sample' in input_data:
            print 'Warning: PEFeaturesDF is supposed to be called on a sample_set'
            self.samples.append(input_data['sample']['md5'])
        else:
            self.samples = input_data['sample_set']['md5_list']

        # Make a sample set
        sample_set = self.workbench.store_sample_set(self.samples)

        # Dense Features               
        dense_features = self.workbench.set_work_request('pe_features', sample_set, ['md5', 'tags', 'dense_features'])

        # Fixme: There's probably a nicer/better way to do this
        flat_features = []
        for feat in dense_features:
            feat['dense_features'].update({'md5': feat['md5'], 'tags': feat['tags']})
            flat_features.append(feat['dense_features'])
        dense_df = pd.DataFrame(flat_features)
        df_packed = dense_df.to_msgpack()
        dense_df_md5 = self.workbench.store_sample(df_packed, 'pe_features_dense_df', 'dataframe')
        
        # Sparse Features
        sparse_features = self.workbench.set_work_request('pe_features', sample_set, ['md5', 'tags', 'sparse_features'])

        # Fixme: There's probably a nicer/better way to do this
        flat_features = []
        for feat in sparse_features:
            feat['sparse_features'].update({'md5': feat['md5'], 'tags': feat['tags']})
            flat_features.append(feat['sparse_features'])
        sparse_df = pd.DataFrame(flat_features)
        df_packed = sparse_df.to_msgpack()
        sparse_df_md5 = self.workbench.store_sample(df_packed, 'pe_features_sparse_df', 'dataframe')

        # Return the dataframes
        return {'dense_features': dense_df_md5, 'sparse_features': sparse_df_md5}
707412
function runGetFeature(callback) {
  var next = _.after(2, callback);
  function featureCallback(error, feature) {
    if (error) {
      callback(error);
      return;
    }
    var latitude = feature.getLocation().getLatitude();
    var longitude = feature.getLocation().getLongitude();
    if (feature.getName() === '') {
      console.log('Found no feature at ' +
          latitude/COORD_FACTOR + ', ' + longitude/COORD_FACTOR);
    } else {
      console.log('Found feature called "' + feature.getName() + '" at ' +
          latitude/COORD_FACTOR + ', ' + longitude/COORD_FACTOR);
    }
    next();
  }
  var point1 = new messages.Point();
  point1.setLatitude(409146138);
  point1.setLongitude(-746188906);
  var point2 = new messages.Point();
  point2.setLatitude(0);
  point2.setLongitude(0);
  client.getFeature(point1, featureCallback);
  client.getFeature(point2, featureCallback);
}
437763
def workflow_get_details(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/getDetails' % object_id, input_params, always_retry=always_retry, **kwargs)
1119558
function getFeature(args) {
    var item = args.item,
      params = args.params,
      propFunc = args.propFunc;

    var feature = { "type": "Feature" };

    feature.geometry = buildGeom(item, params);
    feature.properties = propFunc.call(item);

    return feature;
  }
959444
def getFeatureDynamicLayer(self, oid, dynamicLayer,
                               returnZ=False, returnM=False):
        
        url = self._url + "/dynamicLayer/%s" % oid
        params = {
            "f": "json",
            "returnZ": returnZ,
            "returnM" : returnM,
            "layer": {
                "id": 101,
                "source" : dynamicLayer.asDictionary
            }
        }
        return Feature(
            json_string=self._get(url=url,
                                     param_dict=params,
                                     securityHandler=self._securityHandler,
                                     proxy_port=self._proxy_port,
                                     proxy_url=self._proxy_url)
        )
375146
def _getFeatureById(self, featureId):
        
        featureRef = rdflib.URIRef(featureId)
        featureDetails = self._detailTuples([featureRef])
        feature = {}
        for detail in featureDetails:
            feature[detail['predicate']] = []

        for detail in featureDetails:
            feature[detail['predicate']].append(detail['object'])

        pbFeature = protocol.Feature()

        term = protocol.OntologyTerm()
        # Schema for feature only supports one type of `type`
        # here we default to first OBO defined
        for featureType in sorted(feature[TYPE]):
            if "obolibrary" in featureType:
                term.term = self._featureTypeLabel(featureType)
                term.term_id = featureType
                pbFeature.feature_type.MergeFrom(term)
                break

        pbFeature.id = featureId
        # Schema for feature only supports one type of `name` `symbol`
        # here we default to shortest for symbol and longest for name
        feature[LABEL].sort(key=len)
        pbFeature.gene_symbol = feature[LABEL][0]
        pbFeature.name = feature[LABEL][-1]

        pbFeature.attributes.MergeFrom(protocol.Attributes())
        for key in feature:
            for val in sorted(feature[key]):
                pbFeature.attributes.attr[key].values.add().string_value = val

        if featureId in self._locationMap:
            location = self._locationMap[featureId]
            pbFeature.reference_name = location["chromosome"]
            pbFeature.start = location["begin"]
            pbFeature.end = location["end"]

        return pbFeature
51274
@Override
    public FeatureResponseResult extractFeature(UploadSearchParams uploadSearchParams) {
        try {
            ViSearchHttpResponse response = getPostImageSearchHttpResponse(uploadSearchParams, ENDPOINT_EXTRACT_FEATURE);
            return getFeatureResponseResult(response);
        } catch (InternalViSearchException e) {
            return new FeatureResponseResult(e.getMessage(), e.getCause(), e.getServerRawResponse());
        }
    }
618048
def _fetch_data_from_server(raw_data_id, mysql_cfg):
    """"""
    import pymysql
    import pymysql.cursors

    # Import configuration file
    cfg = utils.get_database_configuration()
    if cfg is None:
        return None

    # Establish database connection
    connection = pymysql.connect(host=cfg[mysql_cfg]['host'],
                                 user=cfg[mysql_cfg]['user'],
                                 passwd=cfg[mysql_cfg]['passwd'],
                                 db=cfg[mysql_cfg]['db'],
                                 cursorclass=pymysql.cursors.DictCursor)
    logging.info("Connection: %s", str(connection))
    cursor = connection.cursor()

    # Download dataset
    sql = ("SELECT `id`, `data` "
           "FROM `wm_raw_draw_data` WHERE `id`=%i") % raw_data_id
    cursor.execute(sql)
    return cursor.fetchone()
1243052
def on_configurationdone_request(self, py_db, request):
        '''
        
        '''
        self.api.run(py_db)
        configuration_done_response = pydevd_base_schema.build_response(request)
        return NetCommand(CMD_RETURN, 0, configuration_done_response, is_json=True)
764205
def runSearchFeatureSets(self, request):
        
        return self.runSearchRequest(
            request, protocol.SearchFeatureSetsRequest,
            protocol.SearchFeatureSetsResponse,
            self.featureSetsGenerator)
1012415
public void gatherAndDisplayMetaDataInfo(Connection conn, WSManagedConnectionFactoryImpl mcf) throws SQLException
    {
        java.sql.DatabaseMetaData mData = conn.getMetaData();

        String databaseProductName = mData.getDatabaseProductName();
        String driverName = mData.getDriverName(); 

        String driverVersion = null;
        String databaseProductVersion = null;
        try {
            driverVersion = mData.getDriverVersion();
            databaseProductVersion = mData.getDatabaseProductVersion();
        } catch (Exception e) {
            // Ignore any Runtime errors as the info collected are solely for FFDC purpose.
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(this, tc, "Exception occurred while getting metaData info. Exception is: ", e);
            }
        }

        setDatabaseProductName(databaseProductName);
        setDriverName(driverName); 
        setDriverMajorVersion(mData.getDriverMajorVersion()); 

        Tr.info(tc, "DB_PRODUCT_NAME", databaseProductName);
        Tr.info(tc, "DB_PRODUCT_VERSION", databaseProductVersion); 
        Tr.info(tc, "JDBC_DRIVER_NAME", driverName); 
        Tr.info(tc, "JDBC_DRIVER_VERSION", driverVersion); 

        try {
            if (mData.supportsResultSetHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT) &&
                mData.supportsResultSetHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT)) {
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "Holdabiliy is supported");
                }
                holdabilitySupported = true;
            } else {
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "Holdability not supported");
                }
                holdabilitySupported = false;
            }

        } catch (Throwable x) {
            if (x instanceof SQLException) {
                SQLException sqe = (SQLException) x;
                if ((isConnectionError(sqe))) {
                    throw sqe; // if this is a stale we need to throw exception here.
                }

                // Some DB drivers throw SQLException when the JDBC version is 2.x.
                // Holdability is not supported in 2.0

                holdabilitySupported = false;
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "getHoldability is not supported in this JDBC driver. Encounter a java.sql.SQLException", sqe);
                }
            } else 
            {
                //NO FFDC needed
                // just log it and do nothing
                if (tc.isDebugEnabled()) {
                    Tr.debug(this, tc, "caught an exception when testing the holdability from metadata, will call the holdability itself to know if supported", x);
                }

            }
        }
        try {
            mcf.jdbcDriverSpecVersion = mData.getJDBCMajorVersion() * 10;
        } catch (AbstractMethodError methError) {
            // No FFDC code needed. JDBC driver version is less than 3.0.
            mcf.jdbcDriverSpecVersion = 20;
        }
        catch (UnsupportedOperationException supportX) // raised by old Sybase driver
        {
            // No FFDC code needed. Driver is not JDBC 3.0 compliant because it does not
            // support getJDBCMajorVersion,
            mcf.jdbcDriverSpecVersion = 20;
        }
        catch (SQLException sqlX) {
            // No FFDC code needed.
            // Informix driver throws SQLException when the JDBC version is 2.x.

            mcf.jdbcDriverSpecVersion = 20;

            if (tc.isDebugEnabled())
                Tr.debug(this, tc, "metadata.getJDBCMajorVersion", sqlX);

            // Need to fail if it was a connection error.
            if (isConnectionError(sqlX))
                throw sqlX;
        }

        if (mcf.jdbcDriverSpecVersion > 30)
            try {
                mcf.jdbcDriverSpecVersion += mData.getJDBCMinorVersion();
            } catch (SQLException x) {
            } catch (UnsupportedOperationException x) {
            }

        if (mcf.jdbcDriverSpecVersion >= 40)
            try 
            {
                // Reset to the default client info of the data source (based on an initial connection),
                // instead of using the default values for the JDBC driver--which could differ from the
                // defaults specified for the data source.
                Properties clientInfo = conn.getClientInfo();
                if (clientInfo != null)
                    mcf.defaultClientInfo.putAll(clientInfo);
            }
            catch (SQLFeatureNotSupportedException featureX) {
                // No FFDC code needed.
                // The JDBC 4.0 driver ought to implement the getClientInfOProperties method,
                // but doesn't.  Issue a warning, but tolerate the error so that WAS can still
                // interoperate with the JDBC driver.
                Tr.warning(tc, "FEATURE_NOT_IMPLEMENTED", "java.sql.Connection.getClientInfo");
            }
            catch (AbstractMethodError methErr) {
                // No FFDC code needed.
                // Work around a bug in Oracle where the driver reports "10" instead
                // of the JDBC specification level.
                // If the JDBC 4.0 metadata operation cannot be found on the driver,
                // then it must really be a JDBC 3.0 driver.
                if (tc.isDebugEnabled())
                    Tr.debug(this, tc,
                             "JDBC spec level, " + mcf.jdbcDriverSpecVersion +
                                             ", reported by the driver is not valid. Using 30 (3.0) instead.");
                mcf.jdbcDriverSpecVersion = 30;
            }
            catch (UnsupportedOperationException operationX) 
            {
                // No FFDC code needed.
                // Returned by Sybase jconn4.jar versions that are older than jConnect-7.07.
                // The JDBC 4.0 driver ought to throw SQLFeatureNotSupportedException,
                // but doesn't.  Issue a warning, but tolerate the error so that WAS can still
                // interoperate with the JDBC driver.
                Tr.warning(tc, "FEATURE_NOT_IMPLEMENTED", "java.sql.Connection.getClientInfo");
            }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(this, tc, "JDBC spec version implemented by driver", mcf.jdbcDriverSpecVersion);
    }
277618
function list(connections, params, cb) {
  async.waterfall([
    function findDataTargets(cb) {
      lookUpDataTargets(connections, {
        query: {},
        lean: true
      }, function(err, dataTargets) {
        if (err) {
          return cb(buildErrorResponse({
            error: err,
            userDetail: "Unexpected Error When Searching For A Data Target",
            code: ERROR_CODES.FH_FORMS_UNEXPECTED_ERROR
          }));
        }

        return cb(undefined, dataTargets);
      });
    }
  ], cb);
}
420198
def get_data(
    dataset,
    query=None,
    crs="epsg:4326",
    bounds=None,
    sortby=None,
    pagesize=10000,
    max_workers=5,
):
    
    param_dicts = define_request(dataset, query, crs, bounds, sortby, pagesize)

    with ThreadPoolExecutor(max_workers=max_workers) as executor:
        results = executor.map(make_request, param_dicts)

    outjson = dict(type="FeatureCollection", features=[])
    for result in results:
        outjson["features"] += result
    return outjson